| 115 | } |
| 116 | |
| 117 | bool FFTBinaryLookup::CacheEntry::exclusive_create() |
| 118 | { |
| 119 | #ifdef _WIN32 |
| 120 | std::wstring tmp; |
| 121 | tmp.assign(this->m_filename.begin(), this->m_filename.end()); |
| 122 | |
| 123 | HANDLE handle = CreateFile(tmp.c_str(), |
| 124 | GENERIC_WRITE, |
| 125 | 0, // no share with other process |
| 126 | NULL, |
| 127 | CREATE_NEW, |
| 128 | FILE_ATTRIBUTE_NORMAL, |
| 129 | NULL); |
| 130 | |
| 131 | this->m_handle = handle; |
| 132 | this->m_successful_creation = (handle != INVALID_HANDLE_VALUE); |
| 133 | return this->m_successful_creation; |
| 134 | #else |
| 135 | int * fd = new int; |
| 136 | *fd = open (this->m_filename.c_str(), |
| 137 | O_CREAT | O_EXCL, |
| 138 | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); |
| 139 | this->m_handle = fd; |
| 140 | this->m_successful_creation = (*fd != -1); |
| 141 | return *fd >= 0; |
| 142 | #endif |
| 143 | } |
| 144 | |
| 145 | FFTBinaryLookup::FFTBinaryLookup(const clfftGenerators gen, const clfftPlanHandle plHandle, cl_context ctxt, cl_device_id device) |
| 146 | : m_context(ctxt), m_device(device), m_program(NULL), m_binary(0), m_signature(0), m_cache_enabled(cache_enabled) |