diff options
Diffstat (limited to 'source3/lib/module.c')
-rw-r--r-- | source3/lib/module.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/source3/lib/module.c b/source3/lib/module.c index 49121d12ca1..885faf8d80e 100644 --- a/source3/lib/module.c +++ b/source3/lib/module.c @@ -231,77 +231,3 @@ void smb_run_idle_events(time_t now) return; } - -/*************************************************************************** - * This Function registers a exit event - * - * the registered functions are run on exit() - * and maybe shutdown idle connections (e.g. to an LDAP server) - ***************************************************************************/ - -struct smb_exit_list_ent { - struct smb_exit_list_ent *prev,*next; - smb_event_id_t id; - smb_exit_event_fn *fn; - void *data; -}; - -static struct smb_exit_list_ent *smb_exit_event_list = NULL; - -smb_event_id_t smb_register_exit_event(smb_exit_event_fn *fn, void *data) -{ - struct smb_exit_list_ent *event; - static smb_event_id_t smb_exit_event_id = 1; - - if (!fn) { - return SMB_EVENT_ID_INVALID; - } - - event = SMB_MALLOC_P(struct smb_exit_list_ent); - if (!event) { - DEBUG(0,("malloc() failed!\n")); - return SMB_EVENT_ID_INVALID; - } - event->fn = fn; - event->data = data; - event->id = smb_exit_event_id++; - - DLIST_ADD(smb_exit_event_list,event); - - return event->id; -} - -BOOL smb_unregister_exit_event(smb_event_id_t id) -{ - struct smb_exit_list_ent *event = smb_exit_event_list; - - while(event) { - if (event->id == id) { - DLIST_REMOVE(smb_exit_event_list,event); - SAFE_FREE(event); - return True; - } - event = event->next; - } - - return False; -} - -void smb_run_exit_events(void) -{ - struct smb_exit_list_ent *event = smb_exit_event_list; - struct smb_exit_list_ent *tmp = NULL; - - while (event) { - event->fn(&event->data); - tmp = event; - event = event->next; - /* exit event should only run one time :-)*/ - SAFE_FREE(tmp); - } - - /* the list is empty now...*/ - smb_exit_event_list = NULL; - - return; -} |