[ofw] [PATCH] complib/user: fix timer race conditions

Hefty, Sean sean.hefty at intel.com
Mon Jun 28 15:02:25 PDT 2010


> > The simple solution is to create a thread and to use timeout options of
> > waitforsingleoject. All other solutions are much more complicated than
> > what one would think.
> 
> Why bother, just have opensm create a thread and do a sleep itself.  Having
> a timer abstraction that just uses a thread for each timer, while
> functional, isn't really a good abstraction.

In the end, I don't think this will end up being any simpler.  Essentially, this re-constructs timer objects from more primitive objects and likely ends up less efficient.

cl_timer_trim requires being able to adjust the timeout, so it's not as simple as using the timeout option of WaitForSingleObject.  Adjusting the timeout would require waking the thread up, so that it can go back to sleep for the proper time, and synchronization is still needed between setting the timeout and waking the thread up.

- Sean



More information about the ofw mailing list