ESA JPIP server  0.1
rdwr_lock.h
Go to the documentation of this file.
1 #ifndef _IPC_RDWR_LOCK_H_
2 #define _IPC_RDWR_LOCK_H_
3 
4 
5 #include <pthread.h>
6 #include "ipc_object.h"
7 
8 
9 namespace ipc
10 {
11 
18  class RdWrLock :public IPCObject
19  {
20  private:
21  pthread_rwlock_t rwlock;
22 
23  public:
27  typedef SHARED_PTR<RdWrLock> Ptr;
28 
33  virtual bool Init();
34 
43  virtual WaitResult Wait(int time_out = -1);
44 
53  WaitResult WaitForWriting(int time_out = -1);
54 
60  virtual bool Dispose();
61 
66  bool Release();
67  };
68 
69 }
70 
71 #endif /* _IPC_RDWR_LOCK_H_ */
Class base of all the IPC classes that has the basic operations (Init, Wait and Dispose) to be overlo...
Definition: ipc_object.h:39
pthread_rwlock_t rwlock
Read/write lock information.
Definition: rdwr_lock.h:21
WaitResult WaitForWriting(int time_out=-1)
Performs a wait operation with the object to get it for writing.
Definition: rdwr_lock.cc:56
virtual bool Dispose()
Release the resources associated to the IPC object and sets the internal status to false...
Definition: rdwr_lock.cc:93
Contains classes for working with the IPC mechanisms available in Linux using the pthread library...
Definition: event.cc:7
bool Release()
Releases the lock.
Definition: rdwr_lock.cc:81
virtual bool Init()
Initializes the object.
Definition: rdwr_lock.cc:13
virtual WaitResult Wait(int time_out=-1)
Performs a wait operation with the object to get it for reading.
Definition: rdwr_lock.cc:31
IPC object that offers the functionality of a read/write lock, implemented by means of the pthread rw...
Definition: rdwr_lock.h:18
SHARED_PTR< RdWrLock > Ptr
Pointer to a RdWrLock object.
Definition: rdwr_lock.h:27
WaitResult
Enumeration of the possible values returned when a wait operation is performed for an IPC object...
Definition: ipc_object.h:16