DragonFly BSD
DragonFly kernel List (threaded) for 2011-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: [gsoc] use of lwkt messages


From: Alex Hornung <ahornung@xxxxxxxxx>
Date: Thu, 23 Jun 2011 12:59:10 +0100

Hi,

2011/6/23 Stéphanie Ouillon <stephanie@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.

HTH,
Alex Hornung




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]