Click here to Skip to main content
16,012,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi. Have a litle(BIG) problem. 1 project 2 classes. 1 thread in each class that I want to share data between them. I put each thread in a for loop. 1 thread is sending and the other is receiving. The queue I use is thread safe.
The Problem is: Thread 1 queue.Enqueue() data and what I can see is, it loads the queue with data, because i look with queue.Count(). When thread 1 loads the queue, It does a queue.Set() on thread 2 that is on queue.WaitOne() but nothing is happening. It doesn't dequeue. I got the same queue class in 2 other threads, used the same technique, and it works fine?????? :((

Best to you all.
Posted
Updated 30-Nov-10 2:02am
v3
Comments
Tarun.K.S 30-Nov-10 8:02am    
Edited for readability. Tried my best!
ARopo 30-Nov-10 10:31am    
Some code would be useful here, I don't clearly unstand you issue
Versile 30-Nov-10 11:00am    
Agree, without some code snippets it's hard to tell. But my approach would be a global object that manages it's own state using a private readonly object and lock commands. That way anytime you retrieve properties of the object or execute methods you can ensure it is threadsafe. Sounds like you may already be doing this, but can't tell without snippets.

1 solution

I got a bit on the way. I´ts some kind of thread problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900