PCL
AutoLock.h File Reference
#include <pcl/Defs.h>
#include <pcl/Diagnostics.h>
#include <pcl/Atomic.h>
#include <pcl/Mutex.h>

Go to the source code of this file.

Classes

class  pcl::AutoLock
 Automatic mutex lock/unlock. More...
 
class  pcl::AutoLockCounter
 Automatic mutex lock/unlock with limited concurrent access allowance. More...
 

Namespaces

 pcl
 PCL root namespace.
 

Macros

#define Synchronized(mutex, code)
 A macro to protect a simple fragment of code with a Mutex object. More...
 

Macro Definition Documentation

◆ Synchronized

#define Synchronized (   mutex,
  code 
)
Value:
{ \
pcl::AutoLock _________( mutex ); \
code \
}

Example of use:

Mutex mutex;
...
Synchronized( mutex, count += img.Width(); )

The protected code should not contain tokens that could invalidate macro argument semantics. To synchronize more complex pieces of code, use an AutoLock object explicitly. For example:

Mutex mutex;
...
{
AutoLock locker( mutex );
... some code to protect here ...
}

Definition at line 367 of file AutoLock.h.