本文整理汇总了C++中libmaus::parallel::OMPLock::lock方法的典型用法代码示例。如果您正苦于以下问题:C++ OMPLock::lock方法的具体用法?C++ OMPLock::lock怎么用?C++ OMPLock::lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libmaus::parallel::OMPLock
的用法示例。
在下文中一共展示了OMPLock::lock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addTempFile
static void addTempFile(std::string const & filename)
{
lock.lock();
setupUnlocked();
tmpfilenames.push_back(filename);
lock.unlock();
}
示例2: write
void write(iterator sa, iterator se)
{
lock.lock();
// wait for free context if all buffers are in use
if ( high-low == numbuffers )
{
aiocb *waitlist[1] = { &contexts[low%numbuffers] };
aio_suspend (waitlist,1,0);
low++;
}
uint64_t const len = se-sa;
buffers[high % numbuffers] = ::libmaus::autoarray::AutoArray<char>(len);
std::copy ( sa, se, buffers[high%numbuffers].get() );
memset ( &contexts[high%numbuffers], 0, sizeof(aiocb) );
contexts[high%numbuffers].aio_fildes = fd;
contexts[high%numbuffers].aio_buf = buffers[high % numbuffers].get();
contexts[high%numbuffers].aio_nbytes = len;
contexts[high%numbuffers].aio_offset = 0;
contexts[high%numbuffers].aio_sigevent.sigev_notify = SIGEV_NONE;
aio_write( & contexts[high%numbuffers] );
high++;
lock.unlock();
}
示例3: setup
static void setup()
{
lock.lock();
setupUnlocked();
lock.unlock();
}
示例4: flush
/**
* flush output file
**/
void flush()
{
lock.lock();
ostr.flush();
lock.unlock();
}