Re: [Quickfix-developers] Faster logons
Brought to you by:
orenmnero
|
From: Brian E. <azz...@ya...> - 2005-11-03 19:08:33
|
Dale - I figured pthreads (Posix threads) would probably have some issues there, but there are several ways to work around it. One way is to do the heavy lifting of writing the proper Posix code to do it. It certainly isn't as clean as the equivalent Win32 code, but I believe it is doable. Another way is to use a phony mutex. Make a minor modification of the Posix code to loop around a smaller timeout (1 second or less). The "interrupt" method for the Posix port could set a variable (posixSleepInterruptPhonyMutex=true) that is checked at the top of the loop and drop out if it has been set. Reset the variable to false when you drop out of the loop. Simple to code, but not nearly as "elegant". Lastly, you could simply NOP the "interrupt" method for the Posix port until we decide on a good solution. The Posix port would be less optimal than the Win32 version, but no worse than the current version. - Brian Erst Thynk Software, Inc. --- Dale Wilson <wil...@oc...> wrote: > Brian Erst wrote: > > ><SNIP> > >I would also suggest that the use of process_sleep is a bad idea - > >whenever I need to code a sleep-type function, I use a mutex and a > >WaitForSingleObject with the sleep time as the timeout. That way, I > can > >interrupt the sleep (by triggering the mutex) if the reason for the > >sleep has gone away (or so I don't have to wait 30 seconds to bring > my > >application down if I'm sleeping). Makes things much more > responsive. > > > > > An excellent idea with one very important drawback. > WaitForSingleObject > with a timeout is a WIN32 concept. > It is possible, but not necessarily easy, to code an equivalent > functionality on a posix system using |pthread_cond_timedwait. > If QuickFIX were going to use this technique someone would have to > beef > up its cross-platform thread synchronization support. > > Dale > > | > > >- Brian Erst > >Thynk Software, Inc. > > > > > > > > > -- > > ----------------------------------------------------- > Dale Wilson, Senior Software Engineer > Object Computing, Inc. (OCI) > http://www.ociweb.com/ http://www.theaceorb.com/ > ---------------------------------------------------- > > |