MCPcopy Create free account
hub / github.com/clMathLibraries/clFFT / exclusive_create

Method exclusive_create

src/library/fft_binary_lookup.cpp:117–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117bool 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
145FFTBinaryLookup::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)

Callers 1

writeCacheFileMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected