]> git.sur5r.net Git - openldap/commitdiff
Change ldap_pvt_runqueue_insert to return new task pointer
authorHoward Chu <hyc@openldap.org>
Fri, 22 Apr 2005 14:37:59 +0000 (14:37 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 22 Apr 2005 14:37:59 +0000 (14:37 +0000)
include/ldap_rq.h
libraries/libldap_r/rq.c

index 551a1eada7bd1fb5fd7c03423e52f38d3adbfd7f..4fc9c072bb9e8c7deb2e0d1af7ab0d0fb48be2e5 100644 (file)
@@ -35,7 +35,7 @@ typedef struct runqueue_s {
        ldap_pvt_thread_mutex_t rq_mutex;
 } runqueue_t;
 
-LDAP_F( void )
+LDAP_F( struct re_s* )
 ldap_pvt_runqueue_insert(
        struct runqueue_s* rq,
        time_t interval,
index bafb12166d62aa8ae70ed4ce7d859217089c0a08..adfaea5641813044aee94feccbef6055e174a885 100644 (file)
@@ -33,7 +33,7 @@
 #include "ldap_queue.h"
 #include "ldap_rq.h"
 
-void
+struct re_s *
 ldap_pvt_runqueue_insert(
        struct runqueue_s* rq,
        time_t interval,
@@ -44,13 +44,16 @@ ldap_pvt_runqueue_insert(
        struct re_s* entry;
 
        entry = (struct re_s *) LDAP_CALLOC( 1, sizeof( struct re_s ));
-       entry->interval.tv_sec = interval;
-       entry->interval.tv_usec = 0;
-       entry->next_sched.tv_sec = time( NULL );
-       entry->next_sched.tv_usec = 0;
-       entry->routine = routine;
-       entry->arg = arg;
-       LDAP_STAILQ_INSERT_TAIL( &rq->task_list, entry, tnext );
+       if ( entry ) {
+               entry->interval.tv_sec = interval;
+               entry->interval.tv_usec = 0;
+               entry->next_sched.tv_sec = time( NULL );
+               entry->next_sched.tv_usec = 0;
+               entry->routine = routine;
+               entry->arg = arg;
+               LDAP_STAILQ_INSERT_TAIL( &rq->task_list, entry, tnext );
+       }
+       return entry;
 }
 
 struct re_s *