[olsr-dev] Routing table & plugin

Andreas T√łnnesen (spam-protected)
Thu Apr 7 09:59:15 CEST 2005

> Anyway, don't you think that it's a strong weakness in the code to let
> plugin developer take a pointer to a critical data structure, without
> protecting it ?

No, not in the way the plugin concept is designed. The whole idea is that
the plugin runs in the same thread as olsrd itself. If the plugin is to be
multithreaded then the develpoer must, as always, protect data access.
There is no way olsrd automatically can do this. One could however make
the whole plugin interface/concept aimed towards multi-threading by
exporting a mutex/lock for the plugin to use on access. But this would
make olsrd much more complex/bloated/CPU hogging IMO. And olsrd is time
critical - so a lengthy block on a mutex for write access within olsrd
could be very bad.
I think it's better that you just go for a solution where you for example
register a scheduled function in the plugin that will run in the olsrd
main thread. Now you create a seperate thread that produces and queues
data for the scheduled function to consume. Now the scheduled function can
do all nessecarry updates to olsrd internals without considering any
synchronization except that between itself and the producer thread.

- Andreas

> Andrea Sini
> _______________________________________________
> olsr-dev mailing list
> (spam-protected)
> https://www.olsr.org/mailman/listinfo/olsr-dev

Andreas T√łnnesen

More information about the Olsr-dev mailing list