[Olsr-dev] mdns plugin how to remove threads

Henning Rogge (spam-protected)
Mon Mar 9 19:14:39 CET 2009


On Montag 09 März 2009 18:50:42 you wrote:
> > Multithreading is bad on some embedded uclib versions.
> > Multithreading AND accessing OLSR data structures is worse.
> >
> > You don't want to look through a lot of AVL trees which could change
> > DURING your tree traversal.
>
> Hi,
>
> I was trying to remove the thread from the code, and so I understood
> why I was needing the thread :)
>
> I have a blocking select() that waits for incoming sniffed packets.
> If I remove the thread the whole olsrd daemon stops waiting for a packet.
>
> If I put a timeout to the select, I may get a high CPU load and I
> guess maybe I can lose some sniffed packet ...
>
> So, any hint to remove the thread?
> I don't know how to do this without threads :(
In scheduler.c you will find the function "add_olsr_socket".

You can use add_olsr_socket for adding your socket to the "polling loop" 
and/or add a handler to be called immediately (will not wait for the polling 
delay to end).

You have to use the flags SP_PR_READ, SP_PR_WRITE, SP_IMM_READ and 
SP_IMM_WRITE to tell the function what kind of callbacks you would like to 
have.

Henning

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20090309/5fa6d953/attachment.sig>


More information about the Olsr-dev mailing list