29 |
#include <stdint.h> |
#include <stdint.h> |
30 |
#include <pthread.h> |
#include <pthread.h> |
31 |
|
|
32 |
|
#include <l4.h> |
33 |
|
|
34 |
#include "cap-server-intern.h" |
#include "cap-server-intern.h" |
35 |
|
|
36 |
|
|
37 |
|
/* When using propagation, the from thread ID returned can differ from |
38 |
|
the one we used for the closed receive. */ |
39 |
|
#define l4_xreceive_timeout(from,timeout,fromp) \ |
40 |
|
(l4_ipc (l4_nilthread, from, timeout,fromp)) |
41 |
|
#define l4_xreceive(from,fromp) \ |
42 |
|
l4_xreceive_timeout (from, l4_timeouts (L4_ZERO_TIME, L4_NEVER), fromp) |
43 |
|
|
44 |
|
|
45 |
/* FIXME: Throughout this file, for debugging the behaviour could be |
/* FIXME: Throughout this file, for debugging the behaviour could be |
46 |
relaxed to return errors to callers which would otherwise be |
relaxed to return errors to callers which would otherwise be |
47 |
ignored (due to malformed requests etc). */ |
ignored (due to malformed requests etc). */ |
367 |
/* When we are started up, we are supposed to listen as soon as |
/* When we are started up, we are supposed to listen as soon as |
368 |
possible to the next incoming message. The first time, we do |
possible to the next incoming message. The first time, we do |
369 |
this without a timeout. */ |
this without a timeout. */ |
370 |
from = manager; |
msg_tag = l4_xreceive (manager, &from); |
|
msg_tag = l4_wait (&from); |
|
371 |
|
|
372 |
while (1) |
while (1) |
373 |
{ |
{ |
399 |
|
|
400 |
/* If we are the current worker, we should wait here for the |
/* If we are the current worker, we should wait here for the |
401 |
next message without a timeout. */ |
next message without a timeout. */ |
402 |
from = manager; |
msg_tag = l4_xreceive (manager, &from); |
|
msg_tag = l4_wait (&from); |
|
403 |
/* From here, we will loop all over to the beginning of the |
/* From here, we will loop all over to the beginning of the |
404 |
while(1) block. */ |
while(1) block. */ |
405 |
} |
} |
636 |
|
|
637 |
/* Now listen for the next message, with a timeout. */ |
/* Now listen for the next message, with a timeout. */ |
638 |
from = manager; |
from = manager; |
639 |
msg_tag = l4_wait_timeout (timeout, &from); |
msg_tag = l4_xreceive_timeout (manager, timeout, &from); |
640 |
|
|
641 |
/* From here, we will loop all over to the beginning of |
/* From here, we will loop all over to the beginning of |
642 |
the while(1) block. */ |
the while(1) block. */ |
696 |
else |
else |
697 |
err = pthread_create_from_l4_tid_np (worker_thread, NULL, |
err = pthread_create_from_l4_tid_np (worker_thread, NULL, |
698 |
worker, manage_mt_worker, info); |
worker, manage_mt_worker, info); |
699 |
|
|
700 |
if (!err) |
if (!err) |
701 |
{ |
{ |
702 |
pthread_detach (*worker_thread); |
pthread_detach (*worker_thread); |