]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
switch to a signal in mod_posix_timer that doesn't conflict with valgrind
authorChristopher Rienzo <chris@rienzo.net>
Thu, 14 Jun 2012 12:03:50 +0000 (12:03 +0000)
committerChristopher Rienzo <chris@rienzo.net>
Thu, 14 Jun 2012 12:03:50 +0000 (12:03 +0000)
src/mod/timers/mod_posix_timer/mod_posix_timer.c
src/mod/timers/mod_posix_timer/test/main.c

index 1cd4586cdc9e178e3f9c70f9ab016e3f7376f1a2..1b10e8904396175c1038c5bfd99a98c7f728036c 100644 (file)
@@ -46,7 +46,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_posix_timer_shutdown);
 SWITCH_MODULE_RUNTIME_FUNCTION(mod_posix_timer_runtime);
 SWITCH_MODULE_DEFINITION(mod_posix_timer, mod_posix_timer_load, mod_posix_timer_shutdown, mod_posix_timer_runtime);
 
-#define SIG SIGRTMAX
+#define SIG (SIGRTMAX - 1)
 #define MAX_INTERVAL 2000 /* ms */
 #define TIMERS_PER_INTERVAL 4
 #define MAX_ACTIVE_TIMERS 256 /* one byte */
index 44f3a34aeacdd7eba8c687b483531b1e85b64db8..9dfff6c778b1c6125281243c841f89dd64503f17 100644 (file)
@@ -115,7 +115,7 @@ static void *module_thread(void *dummy)
 /**
  * Load mod_posix_timer and start the runtime thread
  */
-static void load_module()
+static int load_module()
 {
        fail_count = 0;
        warn_count = 0;
@@ -124,9 +124,11 @@ static void load_module()
        session_count = 0;
        last_reported_session_count = 0;
        shutdown = 0;
-       mod_posix_timer_load(&mod, &pool);
+       if (mod_posix_timer_load(&mod, &pool) != SWITCH_STATUS_SUCCESS) {
+               return -1;
+       }
        timer_if = mod->timer;
-       pthread_create(&module_runtime_thread_id, NULL, module_thread, NULL);
+       return pthread_create(&module_runtime_thread_id, NULL, module_thread, NULL);
 }
 
 /**
@@ -444,12 +446,14 @@ int main (int argc, char **argv)
        struct timespec ts;
        clock_gettime(CLOCK_REALTIME, &ts);
        srand48(ts.tv_nsec);
-       load_module();
+       if (load_module() == -1) {
+               return -1;
+       }
        //test_timer(20, 5.0f, .2f, 1000);
        //test_timer_session(intervals, interval_weights, 4, 2  * 86400.0f, 90, 2000, 30.0, 5.0f);
        while(1) {
                /* stop periodically to trigger timer shutdown */
-               test_timer_session(intervals, interval_weights, 1, 60, 150, 3000, 30.0, 5.0f);
+               test_timer_session(intervals, interval_weights, 1, 60, 150, 190 /* 3000 */, 30.0, 5.0f);
        }
        //test_timer(1000, 5.0f, 1);
        //test_timer(20, 5.0f, .2f, 1000);