[PATCH] fixes an issue when main thread is sleeping when receiving data.
Vincent CHAVANIS <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
- When main thread is sleeping and receiving data by bearerbox, we will be into an infinite loop. This patch fix this by waking-up the main thread. Vincent. -- Telemaque - 06560 SOPHIA-ANTIPOLIS - (FR) Service Technique/Reseau - NOC Direction du Developpement xMS+ http://www.telemaque.fr/ [email protected] Tel : +33 4 92 90 99 84 (fax 9142)
mtbatch_thread.txt
(text/plain, 706 B)
--- /gateway-cvs/utils/mtbatch.c 2009-04-16 12:30:23.000000000 +0200
+++ /gateway/utils/mtbatch.c 2009-04-16 12:32:24.000000000 +0200
@@ -147,6 +147,9 @@
start = t = time(NULL);
while (program_status != shutting_down) {
int ret;
+ /* make sure main thread is awaken */
+ gwthread_wakeup(MAIN_THREAD_ID);
+
/* block infinite for reading messages */
ret = read_from_bearerbox(&msg, INFINITE_TIME);
if (ret == -1)
@@ -425,7 +428,7 @@
/* avoid exiting before sending all msgs */
while(sended > counter_value(counter)) {
- gwthread_sleep(0.1);
+ gwthread_sleep(0.5);
}
program_status = shutting_down;