s3: Add messaging_tdb_event()
authorVolker Lendecke <vl@samba.org>
Wed, 15 Feb 2012 12:53:07 +0000 (13:53 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 17 Apr 2012 08:21:01 +0000 (10:21 +0200)
This is a void* that represents a signal handler attached to some
custom tevent_context. This is necessary to make the tdb based
messaging infrastructure trigger its business when we are sitting in
tevent_loop_once for an event context that is not the main one in the
messaging context.

source3/include/messages.h
source3/lib/messages_local.c

index 2161a77d2838403fd1443d545b557f094689bfca..4b45901afda2fe6718fce6af9895d3efde1dac1e 100644 (file)
@@ -98,6 +98,9 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx,
 
 bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx);
 
+void *messaging_tdb_event(TALLOC_CTX *mem_ctx, struct messaging_context *msg,
+                         struct tevent_context *ev);
+
 NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
                              TALLOC_CTX *mem_ctx,
                              struct messaging_backend **presult);
index b398870e1f2b3354c3e06f4d5b85375c75197050..e20024ae5987dcf8ed8fd9078606f17080844ce2 100644 (file)
@@ -77,6 +77,16 @@ static void messaging_tdb_signal_handler(struct tevent_context *ev_ctx,
        message_dispatch(ctx->msg_ctx);
 }
 
+void *messaging_tdb_event(TALLOC_CTX *mem_ctx, struct messaging_context *msg,
+                         struct tevent_context *ev)
+{
+       struct messaging_tdb_context *msg_tdb = talloc_get_type_abort(
+               msg->local->private_data, struct messaging_tdb_context);
+
+       return tevent_add_signal(ev, mem_ctx, SIGUSR1, 0,
+                                messaging_tdb_signal_handler, msg_tdb);
+}
+
 /****************************************************************************
  Initialise the messaging functions. 
 ****************************************************************************/