static void listener_function(void *p) {
gras_msg_listener_t me = (gras_msg_listener_t)p;
s_gras_msg_t msg;
-
+ xbt_ex_t e;
+ int found =0;
while (1) {
- msg.expe = gras_trp_select(1000);
- gras_msg_recv(msg.expe, &msg);
- xbt_queue_push(me->incomming_messages, &msg);
+ TRY {
+ msg.expe = gras_trp_select(0.5);
+ found =1;
+ }
+ CATCH(e) {
+ // gras_os_sleep(0.01);
+
+ }
+ if (found) {
+ gras_msg_recv(msg.expe, &msg);
+ xbt_queue_push(me->incomming_messages, &msg);
+ found =0;
+ }
}
}
*
* if timeout<0, we ought to implement the adaptative timeout (FIXME)
*
- * if timeout=0, do not wait for new message, only handle the ones already there.
*
* if timeout>0 and no message there, wait at most that amount of time before giving up.
*/