Dynalib Utils
Classes | Macros | Functions
Synchronize.h File Reference
#include <atomic>
#include <thread>
#include <mutex>
Include dependency graph for Synchronize.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  RecursiveLock
 
class  Mutex
 
class  Lock
 
struct  FinalAction< F >
 

Macros

#define synchronized(M)   for(Lock M##_lock = M; M##_lock; M##_lock.setUnlock())
 This macro provides 'Java-like' synchronized blocks in C++. More...
 
#define synch(M)   { Lock M##_lock = M; for (; M##_lock; M##_lock.setUnlock())
 These macros provide 'Java-style' synchronization for methods in C++. More...
 
#define synch_end   }
 
#define finally()   auto _final_obj=_finally([&]
 
#define finally1(M)   auto M##_final_obj=_finally([M]
 
#define finally2(M, M2)   auto M##_final_obj=_finally([M,M2]
 
#define finally3(M, M2, M3)   auto M##_final_obj=_finally([M,M2,M3]
 
#define finally4(M, M2, M3, M4)   auto M##_final_obj=_finally([M,M2,M3,M4]
 
#define finally5(M, M2, M3, M4, M5)   auto M##_final_obj=_finally([M,M2,M3,M4,M5]
 

Functions

template<typename F >
FinalAction< F > _finally (F f)
 

Macro Definition Documentation

◆ finally

#define finally ( )    auto _final_obj=_finally([&]

◆ finally1

#define finally1 (   M)    auto M##_final_obj=_finally([M]

◆ finally2

#define finally2 (   M,
  M2 
)    auto M##_final_obj=_finally([M,M2]

◆ finally3

#define finally3 (   M,
  M2,
  M3 
)    auto M##_final_obj=_finally([M,M2,M3]

◆ finally4

#define finally4 (   M,
  M2,
  M3,
  M4 
)    auto M##_final_obj=_finally([M,M2,M3,M4]

◆ finally5

#define finally5 (   M,
  M2,
  M3,
  M4,
  M5 
)    auto M##_final_obj=_finally([M,M2,M3,M4,M5]

◆ synch

#define synch (   M)    { Lock M##_lock = M; for (; M##_lock; M##_lock.setUnlock())

These macros provide 'Java-style' synchronization for methods in C++.

◆ synch_end

#define synch_end   }

◆ synchronized

#define synchronized (   M)    for(Lock M##_lock = M; M##_lock; M##_lock.setUnlock())

This macro provides 'Java-like' synchronized blocks in C++.

Function Documentation

◆ _finally()

template<typename F >
FinalAction<F> _finally ( f)