[gsoc] use of lwkt messages

Alex Hornung ahornung at gmail.com
Thu Jun 23 05:00:48 PDT 2011


2011/6/23 Stéphanie Ouillon <stephanie at minet.net>:
>     /* lwkt_initport_thread(&sc->sc_port, *(sc->sc_td)); not declared in any
> header ? */
>     &sc->sc_port->mp_waitport(&sc->sc_port, 0);

lwkt_initport_thread should be called from the thread you create, and
passing curthread as second argument.
To wait for messages you use
msg = lwkt_waitport(&sc->sc_port, 0);
. .. do something with the message...
. .. and reply to it, if nothing else so it is drained...
lwkt_replymsg(msg, 0);

The reply port would be a port initialized with
lwkt_initport_replyonly if it is to behave just as a message sink (to
free up messages that are not used anymore).

I suggest you have a look at sys/vfs/devfs/devfs_core.c which makes
heavy use of lwkt messages and is relatively simple. It should also
answer most of the other questions you have regarding lwkt messages.
If you need further info after looking at that, feel free to ask
anything specific.

Alex Hornung

More information about the Kernel mailing list