About Genode::Signal reception
frank.kaiser at ...24...
Fri Jul 2 18:53:52 CEST 2010
I want to use the Genode signalling scheme to control asynchrones data
exchange between a client and a server. To get familiar with it I
started with a test implementation on the server side.
The server's main function fills some data into a buffer and
instantiates a Signal receiver thread which shall dump the buffer
content on signal reception. Then it instantiates a Signal transmitter
to fire a signal at the receiver for one time. The unexpected outcome is
that it looks as if the receiver gets the signal twice.
This is the implementation in main():
Receiver *ser_rx = new (env()->heap()) Receiver(s_rcvr,
Signal_context_capability send_cap = s_rcvr.manage(&ct);
The receiver thread's entry() function (class Receiver derived from
class Thread<>; the constructor's 2nd parameter is a handle to the
buffer already filled with data, which is accessed thru _transmit
inside the function):
int cnt = 0;
Signal signal = _receiver.wait_for_signal();
for (unsigned out = 0; out < sizeof(ch); ++out)
int rd = _transmit.read_byte();
if (rd >= 0) ch[out] = uint8_t(rd);
ch = '\0';
printf("Found characters: %s\n", &ch);
ch = '\0';
printf("Caught signals: %d\n", cnt);
The debug output shows that the 2 printf()s inside the while() loop are
called 2 times, which clearly indicates that _receiver.wait_for_signal()
returned 2 times. I wonder what goes wrong, and what I should do to get
rid of this odd behaviour.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users