From: Enlightenment C. <no...@cv...> - 2006-11-11 06:03:44
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas Dir : e17/libs/evas/src/lib/include Modified Files: evas_common.h Log Message: simply as PLACEHOLDER for a glitz engine. i plan on making it almost identical to the xrender engine - but xrender and glitz do not map entirely 1:1 api-wise. =================================================================== RCS file: /cvs/e/e17/libs/evas/src/lib/include/evas_common.h,v retrieving revision 1.69 retrieving revision 1.70 diff -u -3 -r1.69 -r1.70 --- evas_common.h 28 Oct 2006 03:02:21 -0000 1.69 +++ evas_common.h 11 Nov 2006 06:03:13 -0000 1.70 @@ -14,26 +14,39 @@ #ifdef BUILD_PTHREAD # include <pthread.h> -# define RLK struct { pthread_rwlock_t rwl; } _reslock -# define RLK_ADD(x) pthread_rwlock_init (&((x)->_reslock.rwl), NULL) -# define RLK_DEL(x) pthread_rwlock_destroy(&((x)->_reslock.rwl)) -# define RLK_RLK(x) pthread_rwlock_rdlock (&((x)->_reslock.rwl)) -# define RLK_WLK(x) pthread_rwlock_wrlock (&((x)->_reslock.rwl)) -# define RLK_ULK(x) pthread_rwlock_unlock (&((x)->_reslock.rwl)) +typedef struct _Lk Lk; + +struct _Lk +{ + pthread_mutex_t mutex; // lock for read/write to this struct + pthread_t wlk_id; // who has the write lock + int wlk_count; // how many times does the write lock have refs + int rlk_count; // read lock count +// pthread_rwlock_t rwl; +}; + +# define ELK Lk _lk +# define ELK_ADD(x) _evas_lk_init(&((x)->_lk)) +# define ELK_DEL(x) _evas_lk_destroy(&((x)->_lk)) +# define ELK_RLK(x) _evas_lk_read_lock(&((x)->_lk)) +# define ELK_WLK(x) _evas_lk_read_unlock(&((x)->_lk)) +# define ELK_RUL(x) _evas_lk_write_lock(&((x)->_lk)) +# define ELK_WUL(x) _evas_lk_write_unlock(&((x)->_lk)) #else -# define RLK -# define RLK_ADD(x) -# define RLK_DEL(x) -# define RLK_RLK(x) -# define RLK_WLK(x) -# define RLK_ULK(x) +# define ELK +# define ELK_ADD(x) +# define ELK_DEL(x) +# define ELK_RLK(x) +# define ELK_WLK(x) +# define ELK_RUL(x) +# define ELK_WUL(x) #endif -typedef struct _Genlock Genlock; +typedef struct _Glk Glk; -struct _Genlock +struct _Glk { - RLK; + ELK; int _dummy; }; |