#include <Handle.hpp>
Public Methods | |
| Handle () | |
| Handle (JObject *obj) | |
| Handle (const Handle &right) | |
| Handle (JObject *obj, ULONG *rc, pthread_mutexattr_t *a, pthread_mutex_t *m) | |
| virtual | ~Handle () |
| Handle & | operator= (const Handle &right) |
| JObject * | operator-> () const |
| JObject & | operator * () const |
| operator bool () const | |
Private Methods | |
| __inline void | addRef () |
| void | removeRef () |
Private Attributes | |
| JObject * | object |
| ULONG * | refCount |
| pthread_mutexattr_t * | mutexAttr |
| pthread_mutex_t * | mutex |
|
|
Definition at line 51 of file Handle.cpp. |
|
|
Definition at line 55 of file Handle.cpp. 00056 : object( obj ) 00057 { 00058 00059 if ( object != NULL ) { 00060 refCount = new ULONG(1); 00061 mutexAttr = new pthread_mutexattr_t; 00062 mutex = new pthread_mutex_t; 00063 pthread_mutexattr_init(mutexAttr); 00064 pthread_mutex_init(mutex, mutexAttr); 00065 } else { 00066 refCount = NULL; 00067 mutexAttr = NULL; 00068 mutex = NULL; 00069 } 00070 } |
|
|
Definition at line 72 of file Handle.cpp. |
|
||||||||||||||||||||
|
Definition at line 79 of file Handle.cpp. |
|
|
Definition at line 86 of file Handle.cpp. 00086 {
00087 removeRef();
00088 }
|
|
|
Definition at line 6 of file Handle.cpp. Referenced by Handle(), and operator=().
00006 {
00007 if ( object != NULL ) {
00008 pthread_mutex_lock(mutex);
00009 ++(*refCount);
00010 pthread_mutex_unlock(mutex);
00011 }
00012 }
|
|
|
Definition at line 110 of file Handle.cpp. 00110 {
00111 return *object;
00112 }
|
|
|
|
|
|
Definition at line 105 of file Handle.cpp. 00105 {
00106 return object;
00107 }
|
|
|
Definition at line 90 of file Handle.cpp. |
|
|
Definition at line 14 of file Handle.cpp. Referenced by operator=(), and ~Handle().
00014 {
00015 if ( object != NULL ) {
00016 pthread_mutex_lock(mutex);
00017
00018 if ( --(*refCount) == 0 ) {
00019 pthread_mutex_unlock(mutex);
00020 pthread_mutex_destroy(mutex);
00021 pthread_mutexattr_destroy(mutexAttr);
00022
00023 if ( mutex != NULL ) {
00024 delete mutex;
00025 mutex = NULL;
00026 }
00027
00028 if ( mutexAttr != NULL ) {
00029 delete mutexAttr;
00030 mutexAttr = NULL;
00031 }
00032
00033 if ( refCount != NULL ) {
00034 delete refCount;
00035 refCount = NULL;
00036 }
00037
00038 if ( object != NULL ) {
00039 delete object;
00040 object = NULL;
00041 }
00042
00043 } else {
00044 pthread_mutex_unlock(mutex);
00045 }
00046
00047 }
00048 }
|
|
|
Definition at line 51 of file Handle.hpp. Referenced by operator=().
|
|
|
Definition at line 50 of file Handle.hpp. Referenced by operator=().
|
|
|
Definition at line 48 of file Handle.hpp. Referenced by operator=().
|
|
|
Definition at line 49 of file Handle.hpp. Referenced by operator=().
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001