[muscle] Thread-safe queues
- From: Paal Grana <paal.grana@xxxxxxxxxx>
- To: muscle@xxxxxxxxxxxxx
- Date: Mon, 21 Feb 2005 14:31:58 +0100
Is it possible to use a Queue object from two different threads like this:
Queue<MessageRef> msgQueue
Thread1:
MessageRef getmsgRef;
while (1)
...
msgQueue->RemoveHead(getmsgRef); // Get data from
queue
...
Thread2:
MessageRef putmsgRef;
while (1)
...
inQueue->AddTail(putmsgRef); // Put data in to
queue
...
I want to send data from one thread to another (producer - consumer )
using a Queue.
Will I have to use EnterCriticalSection() around RemoveHead/AddTail?
I also want to use SendMessageToSessions() in another thread than the one
where my Win32MessageTransceiverThread-loop is running.
I have run into problems doing this and the reason seems to be
multi-threading related.
Best regards,
Paal Grana
- Follow-Ups:
- [muscle] Re: Thread-safe queues
- From: Jeremy Friesner
Other related posts:
- » [muscle] Thread-safe queues
- » [muscle] Re: Thread-safe queues
- [muscle] Re: Thread-safe queues
- From: Jeremy Friesner