]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3553 --resolve
authorJeff Lenk <jeff@jefflenk.com>
Wed, 16 Nov 2011 22:00:14 +0000 (16:00 -0600)
committerJeff Lenk <jeff@jefflenk.com>
Wed, 16 Nov 2011 22:00:14 +0000 (16:00 -0600)
src/include/switch_cpp.h
src/switch_cpp.cpp

index 5177c467ae8bd475d3eb9674522bb861bf6afb05..44e85185a6c6bafbb7b0e7e327a2b66f518525db 100644 (file)
@@ -189,7 +189,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                 SWITCH_DECLARE_CONSTRUCTOR EventConsumer(const char *event_name = NULL, const char *subclass_name = "");
                 SWITCH_DECLARE_CONSTRUCTOR ~ EventConsumer();
                 SWITCH_DECLARE(int) bind(const char *event_name, const char *subclass_name = "");
-                SWITCH_DECLARE(Event *) pop(int block = 0);
+                SWITCH_DECLARE(Event *) pop(int block = 0, int timeout = 0);
         };
 
 #ifdef SWIG
index 47bc1d50ec95df2150677df971753865f86341f2..91d0980444189b75728999c3fa2155506099b09a 100644 (file)
@@ -85,14 +85,18 @@ SWITCH_DECLARE(int) EventConsumer::bind(const char *event_name, const char *subc
 }
 
 
-SWITCH_DECLARE(Event *) EventConsumer::pop(int block)
+SWITCH_DECLARE(Event *) EventConsumer::pop(int block, int timeout)
 {
        void *pop = NULL;
        Event *ret = NULL;
        switch_event_t *event;
        
        if (block) {
-               switch_queue_pop(events, &pop);
+               if (timeout > 0) {
+                       switch_queue_pop_timeout(events, &pop, (switch_interval_time_t) timeout * 1000); // millisec rather than microsec
+               } else {
+                       switch_queue_pop(events, &pop);
+               }
        } else {
                switch_queue_trypop(events, &pop);
        }