Scippy

UG

Ubiquity Generator framework

paraPthLock.h File Reference

Pthread lock for UG Framework. More...

#include <pthread.h>
#include <iostream>

Go to the source code of this file.

Classes

struct  LockException
 Exception that is thrown whenever something goes wrong with a lock. More...
 
class  Lock
 Class that implements a lock. The class wraps around pthread_mutex_t and adds some safeguards. More...
 
class  LockRAII
 Class to do RAII with a lock. The constructor will acquire the lock and the destructor will delete it. More...
 
class  LockRAIIHelper
 Same as LockRAII but with additional members to implement the LOCKED macro. More...
 

Namespaces

 UG
 

Macros

#define LOCK_VERBOSE   0
 
#define LOCKED(lck)   for (LockRAIIHelper raii_(lck,__FILE__, __LINE__); raii_; ++raii_)
 
#define LOCK_RAII(lck)   LockRAII raii_(lck, __FILE__, __LINE__)
 

Detailed Description

Pthread lock for UG Framework.

Author
Yuji Shinano

Many thanks to Daniel Junglas.

Definition in file paraPthLock.h.

Macro Definition Documentation

◆ LOCK_RAII

◆ LOCK_VERBOSE

#define LOCK_VERBOSE   0

Definition at line 46 of file paraPthLock.h.

Referenced by Lock::lock(), and Lock::unlock().

◆ LOCKED

#define LOCKED (   lck)    for (LockRAIIHelper raii_(lck,__FILE__, __LINE__); raii_; ++raii_)

Macro to execute code that is guarded by a lock. Usage is like this: Lock l; LOCKED(&l) CODE where CODE is either a single statement or a block. The macro acquires l, executes CODE and then releases l. Acquisition and release of the lock are exception safe.

Definition at line 292 of file paraPthLock.h.

Referenced by ParaCommPth::iProbe(), ParaCommPth::lcInit(), ParaCommPth::receive(), ParaCommPth::send(), ParaCommPth::solverDel(), ParaCommPth::solverInit(), ParaCommPth::solverReInit(), ParaCommPth::uTypeReceive(), ParaCommPth::uTypeSend(), and ParaCommPth::waitUntilRegistered().