Rev 1463 | Rev 1470 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1463 | Rev 1466 | ||
---|---|---|---|
Line 162... | Line 162... | ||
162 | return 1; |
162 | return 1; |
163 | if (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec > tv2->tv_usec) |
163 | if (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec > tv2->tv_usec) |
164 | return 1; |
164 | return 1; |
165 | return 0; |
165 | return 0; |
166 | } |
166 | } |
- | 167 | static int tv_gteq(struct timeval *tv1, struct timeval *tv2) |
|
- | 168 | { |
|
- | 169 | if (tv1->tv_sec > tv2->tv_sec) |
|
- | 170 | return 1; |
|
- | 171 | if (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec >= tv2->tv_usec) |
|
- | 172 | return 1; |
|
- | 173 | return 0; |
|
- | 174 | } |
|
167 | 175 | ||
168 | /* Hash table functions */ |
176 | /* Hash table functions */ |
169 | #define CONN_HASH_TABLE_CHAINS 32 |
177 | #define CONN_HASH_TABLE_CHAINS 32 |
170 | 178 | ||
171 | static hash_index_t conn_hash(unsigned long *key) |
179 | static hash_index_t conn_hash(unsigned long *key) |
Line 238... | Line 246... | ||
238 | { |
246 | { |
239 | msg_t *msg; |
247 | msg_t *msg; |
240 | ipc_callid_t callid; |
248 | ipc_callid_t callid; |
241 | connection_t *conn; |
249 | connection_t *conn; |
242 | 250 | ||
- | 251 | assert(PS_connection); |
|
- | 252 | ||
243 | futex_down(&async_futex); |
253 | futex_down(&async_futex); |
244 | 254 | ||
245 | conn = PS_connection; |
255 | conn = PS_connection; |
246 | /* If nothing in queue, wait until something appears */ |
256 | /* If nothing in queue, wait until something appears */ |
247 | if (list_empty(&conn->msg_queue)) { |
257 | if (list_empty(&conn->msg_queue)) { |
Line 433... | Line 443... | ||
433 | } |
443 | } |
434 | futex_down(&async_futex); |
444 | futex_down(&async_futex); |
435 | if (!list_empty(&timeout_list)) { |
445 | if (!list_empty(&timeout_list)) { |
436 | amsg = list_get_instance(timeout_list.next,amsg_t,link); |
446 | amsg = list_get_instance(timeout_list.next,amsg_t,link); |
437 | gettimeofday(&tv,NULL); |
447 | gettimeofday(&tv,NULL); |
438 | if (tv_gt(&tv, &amsg->expires)) { |
448 | if (tv_gteq(&tv, &amsg->expires)) { |
439 | handle_expired_timeouts(); |
449 | handle_expired_timeouts(); |
440 | continue; |
450 | continue; |
441 | } else |
451 | } else |
442 | timeout = tv_sub(&amsg->expires, &tv); |
452 | timeout = tv_sub(&amsg->expires, &tv); |
443 | } else |
453 | } else |
Line 586... | Line 596... | ||
586 | amsg_t *cur; |
596 | amsg_t *cur; |
587 | 597 | ||
588 | tmp = timeout_list.next; |
598 | tmp = timeout_list.next; |
589 | while (tmp != &timeout_list) { |
599 | while (tmp != &timeout_list) { |
590 | cur = list_get_instance(tmp, amsg_t, link); |
600 | cur = list_get_instance(tmp, amsg_t, link); |
591 | if (tv_gt(&cur->expires, &msg->expires)) |
601 | if (tv_gteq(&cur->expires, &msg->expires)) |
592 | break; |
602 | break; |
593 | tmp = tmp->next; |
603 | tmp = tmp->next; |
594 | } |
604 | } |
595 | list_append(&msg->link, tmp); |
605 | list_append(&msg->link, tmp); |
596 | } |
606 | } |