RE: [Quickfix-developers] Incorrect threading function.
Brought to you by:
orenmnero
From: Daniel M. <Dan...@ma...> - 2003-11-21 11:39:15
|
Tim, Have you checked these changes into CVS ? Daniel May da...@ma... --__--__-- Message: 2 From: Timothy Yates <ty...@pa...> To: "'qui...@li...'" <qui...@li...> Date: Thu, 20 Nov 2003 16:06:58 -0000 Subject: [Quickfix-developers] Incorrect threading function. I am using the Java quickfix API and running on a fast (3GHz) processor on Windows XP. I have encountered a number of threading problems. 1. It is quite common for QuickFIX to lock up in Acceptor.stop(). The lock-up occurs due to incorrect implementation of thread_spawn/thread_join. These should use _beginthreadex, not _beginthread. In the current implementation (using _beginthread), the call too WaitForSingleObject() generally fails because the handle it is waiting for has already been closed automatically by _beginthread. Sometimes, WaitForSingleObject() blocks indefinitely even though the acceptor thread has exited. This may be because it is waiting on an incorrect handle for which no event is likely to be signalled. In any case, the Windows documentation advises against using _beginthread and WaitForSingleObject together. 2. When stopping a SocketAcceptor there is a race condition between completion of the acceptor thread function and destruction of the SocketServer object. Since the thread function uses the SocketServer object, it should not be destroyed until the thread function has completed. I'm not sure that this is causing problems, but it looks dangerous. 3. The stack trace facility (QF_STACK_PUSH/QF_STACK_POP) does not work on Windows. This is due to incorrect implementation of thread_self(). GetCurrentThread() returns a pseudo handle, which seems to be the same irrespective of thread. I replaced this with a call to GetCurrentThreadId(). Tim Yates Lead Developer Patsystems (US) LLC 141 West Jackson Boulevard Chicago 60604, USA Tel +1 (312) 542-1336 www.patsystems.com=20 DISCLAIMER: This e-mail is confidential and may also be legally privileged. If you are not the intended recipient, use of the information contained in this e-mail (including disclosure, copying or distribution) is prohibited and may be unlawful. Please inform the sender and delete the message immediately from your system. This e-mail is attributed to the sender and may not necessarily reflect the views of the Patsystems Group and no member of the Patsystems Group accepts any liability for any action taken in reliance on the contents of this e-mail (other than where it has a legal or regulatory obligation to do so) or for the consequences of any computer viruses which may have been transmitted by this e-mail. The Patsystems Group comprises Patsystems plc and its subsidiary group of companies. --__--__-- _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers End of Quickfix-developers Digest |