[olsr-dev] Re: olsr bmf question
Ignacio García Pérez
Tue Jan 2 16:50:11 CET 2007
Andreas Tønnesen escribió:
>> The timeout parameter is passed to the select() call as a pointer, so
>> it COULD return the remaining time there. In fact, IT DOES in linux,
>> thus implementation of this scheme in linux is perfectly possible
>> (I've done that before), but this is a particularity of linux. In
>> fact, posix says the timeout return value of select() is undefined,
>> so the problem would be the implementation on other operating systems.
> I seem to remember having used this approach in olsrd earlier...
> Hmmm... might
> just be that I've planned on doing it that way. Anyways, yes, I think
> using select
> with a timeout instead of sleeping is a good idea. And as for the
> return value
> of the timeval I guess the best thing would be just to grab a
> timestamp prior
> to and after calling select(after if the FD set was set, and after the
> data was
> processed which would not be taken into account if just using the
> timeval) and keep on calling select until the scheduler should kick in.
> I do not believe this is something for the next release which will
> mainly be a bugfix
> release, but I agree it should be addressed pretty soon.
I sort of need it for an experimental plugin I'm developing. As happens
with the BMF plugin, I need immediate handling of incoming packets, but
do not want to use a sepparate thread because that introduces race
conditions that compromise the stability of the whole olsrd process.
I'll give it a quick shot and see how hard would it be to refactor the
code this way. As I have to study the olsrd code, any indications on
where to look and what to change will be greatly appreciated.
> - Andreas
> olsr-dev mailing list
More information about the Olsr-dev