diff options
Diffstat (limited to 'source/lib/messages.c')
-rw-r--r-- | source/lib/messages.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/source/lib/messages.c b/source/lib/messages.c index 9d2d46e4114..7e6c2a75ac6 100644 --- a/source/lib/messages.c +++ b/source/lib/messages.c @@ -456,66 +456,3 @@ BOOL message_send_all(TDB_CONTEXT *conn_tdb, int msg_type, *n_sent = msg_all.n_sent; return True; } - -/** @} **/ - -static SIG_ATOMIC_T gotalarm; - -/*************************************************************** - Signal function to tell us we timed out. -****************************************************************/ - -static void gotalarm_sig(void) -{ - gotalarm = 1; -} - -/* - lock the messaging tdb based on a string - this is used as a primitive form of mutex - between smbd instances. -*/ -BOOL message_named_mutex(const char *name, unsigned int timeout) -{ - TDB_DATA key; - int ret; - - if (!message_init()) - return False; - - key.dptr = (char *)name; - key.dsize = strlen(name)+1; - - if (timeout) { - gotalarm = 0; - CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig); - alarm(timeout); - } - - ret = tdb_chainlock(tdb, key); - - if (timeout) { - alarm(0); - CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN); - if (gotalarm) - return False; - } - - if (ret == 0) - DEBUG(10,("message_named_mutex: got mutex for %s\n", name )); - - return (ret == 0); -} - -/* - unlock a named mutex -*/ -void message_named_mutex_release(char *name) -{ - TDB_DATA key; - - key.dptr = name; - key.dsize = strlen(name)+1; - - tdb_chainunlock(tdb, key); - DEBUG(10,("message_named_mutex: released mutex for %s\n", name )); -} |