Re: [Quickfix-developers] Sending messages from different threads on the same session....
Brought to you by:
orenmnero
From: <OM...@th...> - 2003-02-14 17:35:31
|
Thanks for this report. This had been discovered previously and a fix was checked in last month. The fix is just what you suggest except that the mutex was moved from send into sendRaw, instead of adding an additional lock. Here is a link to the diff. http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/quickfix/quickfix/src/C%2b%2b/Session.cpp.diff?r1=1.5&r2=1.6 --oren |---------+-----------------------------------------------> | | "Stancescu Constantin" | | | <Con...@sw...> | | | Sent by: | | | qui...@li...ur| | | ceforge.net | | | | | | | | | 02/14/2003 11:25 AM | | | | |---------+-----------------------------------------------> >----------------------------------------------------------------------------------------------| | | | To: <qui...@li...> | | cc: | | Subject: [Quickfix-developers] Sending messages from different threads on the same | | session.... | >----------------------------------------------------------------------------------------------| My application does this, in fact most applications will have at least two potential senders: 1.The working thread of the application that sends business messages. 2.The receiving thread in case errors or other type of responses. The sendRaw functions works like: 1. getNextSenderMsgSeqNum called by Fill(header); ............................................ 2. send( message.toString() ); ............................................ 3. m_state.set( msgSeqNum, message.toString() ); 4. m_state.incrNextSenderMsgSeqNum(); Imagine a thread switch from Thread_A to Thread_B with 1. < Thread_A < 4. -->> BOTH THREADS ARE GETTING THE SAME SEQUENCE NUMBER FOR DIFFERENT MESSAGES !! One line of code at the very begin of sendRaw solved my problem Locker l(m_mutex); I suggest to include this in the base code: 1.If an application always sends messages from only one thread it will not harm. 2.If an application sends messages from several threads it is needed. This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company. ------------------------------------------------------- This SF.NET email is sponsored by: FREE SSL Guide from Thawte are you planning your Web Server Security? Click here to get a FREE Thawte SSL guide and find the answers to all your SSL security issues. http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers |