00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "lib/mutex.h"
00023
00029 LumieraMutex
00030 lumiera_mutex_init (LumieraMutex self,
00031 const char* purpose,
00032 struct nobug_flag* flag,
00033 const struct nobug_context ctx)
00034 {
00035 if (self)
00036 {
00037 NOBUG_RESOURCE_HANDLE_INIT (self->rh);
00038 NOBUG_RESOURCE_ANNOUNCE_RAW_CTX (flag, "mutex", purpose, self, self->rh, ctx)
00039 {
00040 pthread_mutex_init (&self->mutex, NULL);
00041 }
00042 }
00043 return self;
00044 }
00045
00046
00047 LumieraMutex
00048 lumiera_mutex_destroy (LumieraMutex self,
00049 struct nobug_flag* flag,
00050 const struct nobug_context ctx)
00051 {
00052 if (self)
00053 {
00054 NOBUG_RESOURCE_FORGET_RAW_CTX (flag, self->rh, ctx)
00055 {
00056 if (pthread_mutex_destroy (&self->mutex))
00057 LUMIERA_DIE (LOCK_DESTROY);
00058 }
00059 }
00060 return self;
00061 }
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071