About Genode::Signal reception

Frank Kaiser 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():

    Signal_receiver s_rcvr;

    Signal_context ct;

    Receiver *ser_rx = new (env()->heap()) Receiver(s_rcvr,

    Signal_context_capability send_cap = s_rcvr.manage(&ct);

    Signal_transmitter tx(send_cap);


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):

        void entry()


            uint8_t ch[32];

            int cnt = 0;

            while (1)


                Signal signal = _receiver.wait_for_signal();

#if 1

                for (unsigned out = 0; out < sizeof(ch); ++out)


                    int rd = _transmit.read_byte();

                    if (rd >= 0) ch[out] = uint8_t(rd);

                    else break;



                ch[31] = '\0';

                printf("Found characters: %s\n", &ch[0]);

                ch[0] = '\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...
URL: <http://lists.genode.org/pipermail/users/attachments/20100702/08b10dd8/attachment.html>

More information about the users mailing list