FS-3553 --resolve

This commit is contained in:
Jeff Lenk 2011-11-16 16:00:14 -06:00
parent 189e0161c9
commit b992e29640
2 changed files with 7 additions and 3 deletions

View 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(const char *event_name = NULL, const char *subclass_name = "");
SWITCH_DECLARE_CONSTRUCTOR ~ EventConsumer(); SWITCH_DECLARE_CONSTRUCTOR ~ EventConsumer();
SWITCH_DECLARE(int) bind(const char *event_name, const char *subclass_name = ""); 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 #ifdef SWIG

View 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; void *pop = NULL;
Event *ret = NULL; Event *ret = NULL;
switch_event_t *event; switch_event_t *event;
if (block) { if (block) {
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); switch_queue_pop(events, &pop);
}
} else { } else {
switch_queue_trypop(events, &pop); switch_queue_trypop(events, &pop);
} }