diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-01-31 20:59:10 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-01-31 20:59:10 +0400 |
commit | 9023eb3f1e85e456ee8804b7867c9e17ada5aa6e (patch) | |
tree | a3861a28d1cfd8cd47c6168ff42bf3630c31411f /src/kvstorage.h | |
parent | a874d5eb9fe0a2e1ddf1a0f48e6df41845be087f (diff) | |
download | rspamd-9023eb3f1e85e456ee8804b7867c9e17ada5aa6e.tar.gz rspamd-9023eb3f1e85e456ee8804b7867c9e17ada5aa6e.zip |
Adopt rspamd for the next glib release.
Fix several issues in threads handling inside keystorage.
Fix sigsuspend usage in keystorage.
Diffstat (limited to 'src/kvstorage.h')
-rw-r--r-- | src/kvstorage.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/kvstorage.h b/src/kvstorage.h index d32db2ee4..d1e2c1635 100644 --- a/src/kvstorage.h +++ b/src/kvstorage.h @@ -32,6 +32,19 @@ struct rspamd_kv_storage; struct rspamd_kv_expire; struct rspamd_kv_element; +/* Locking definitions */ +#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION > 30)) +#define RW_R_LOCK g_rw_lock_reader_lock +#define RW_R_UNLOCK g_rw_lock_reader_unlock +#define RW_W_LOCK g_rw_lock_writer_lock +#define RW_W_UNLOCK g_rw_lock_writer_unlock +#else +#define RW_R_LOCK g_static_rw_lock_reader_lock +#define RW_R_UNLOCK g_static_rw_lock_reader_unlock +#define RW_W_LOCK g_static_rw_lock_writer_lock +#define RW_W_UNLOCK g_static_rw_lock_writer_unlock +#endif + /* Callbacks for cache */ typedef void (*cache_init)(struct rspamd_kv_cache *cache); typedef struct rspamd_kv_element* (*cache_insert)(struct rspamd_kv_cache *cache, @@ -140,7 +153,11 @@ struct rspamd_kv_storage { gchar *name; /* numeric ID */ gboolean no_overwrite; /* do not overwrite data with the same keys */ +#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION > 30)) + GRWLock rwlock; /* rwlock in new glib */ +#else GStaticRWLock rwlock; /* rwlock for threaded access */ +#endif }; /** Create new kv storage */ |