473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Queue Thread Safe question

The Collections.Queue class has a Synchronized property.

My colleague was saying that this means that we can use the queue in a
multi-threaded app and not worry about normal threading issues.

Is this true, or is it a faulty assumption and would he still need to use
Reader/Writer locks?

Thanks,

Shane
Nov 21 '05 #1
2 1373
Check out
http://msdn.microsoft.com/library/de...readsafety.asp
"Shane Story" <sh**************@dv-corp.com> wrote in message
news:eX**************@TK2MSFTNGP10.phx.gbl...
The Collections.Queue class has a Synchronized property.

My colleague was saying that this means that we can use the queue in a
multi-threaded app and not worry about normal threading issues.

Is this true, or is it a faulty assumption and would he still need to use
Reader/Writer locks?

Thanks,

Shane

Nov 21 '05 #2
thanks for the link...

So from what I read, it seems that if the queue returns another queue
through the synchronized method and you only use it, there are no problems.

Shane

"OpticTygre" <op********@adelphia.net> wrote in message
news:QM********************@adelphia.com...
Check out
http://msdn.microsoft.com/library/de...readsafety.asp
"Shane Story" <sh**************@dv-corp.com> wrote in message
news:eX**************@TK2MSFTNGP10.phx.gbl...
The Collections.Queue class has a Synchronized property.

My colleague was saying that this means that we can use the queue in a
multi-threaded app and not worry about normal threading issues.

Is this true, or is it a faulty assumption and would he still need to use
Reader/Writer locks?

Thanks,

Shane


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: phil | last post by:
And sorry I got ticked, frustrating week >And I could help more, being fairly experienced with >threading issues and race conditions and such, but >as I tried to indicate in the first place,...
2
by: Sriram Rajagopalan | last post by:
Hi, Are STL queues thread safe in the scenario below: I have 2 threads, one pushing to the rear end of the STL queue.. then posting a semaphore- The other thread waits for the semaphore and...
3
by: palm | last post by:
Hi I have a system.collection.queue object. One thread X enque objects into this queue and another thread Y dequeues object and process them. I want to add a listener for this queue in thread Y...
2
by: Chuck | last post by:
I have not been able to find a good answer about the System.Collections.Queue.Synchronized() method and how it actually works or is to be used. If I create my Queue in the following manner: ...
0
by: Wavemaker | last post by:
One of the things I've struggled with from time to time is handling events raised on different threads. For example, an object could be listening to events from one or more objects running in...
8
by: Jun | last post by:
hi, just want to know if std::queue empty() is thread safe (running on 2 or more thread)... so i can do, if( !queue.empty() ) { lock() .... unlock()
0
by: Dave Coate | last post by:
I am working on a generic way to launch multiple similar processes (threads) at once, but limit the number of threads running at any one time to a number I set. As I understand it the following...
4
by: nhmark64 | last post by:
Hi, Does System.Collections.Generic.Queue not have a Synchronized method because it is already in effect synchronized, or is the Synchronized functionality missing from...
4
by: Russell Warren | last post by:
I'm guessing no, since it skips down through any Lock semantics, but I'm wondering what the best way to clear a Queue is then. Esentially I want to do a "get all" and ignore what pops out, but I...
19
by: =?ISO-8859-1?Q?Nordl=F6w?= | last post by:
I am currently designing a synchronized queue used to communicate between threads. Is the code given below a good solution? Am I using mutex lock/unlock more than needed? Are there any resources...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.