dcsimg
Thread Safe Object/Class
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Abhinav_Srivastava
Posted On:   Monday, February 10, 2003 11:17 PM

An object would be Thread-Unsafe if it is stored as Member/Static Variable in a class whose different methods are invoked in different Threads.
Is this what we mean when we say that Vector is Thread-Safe?
Does it help in any other scenario as well?

Re: Thread Safe Object/Class

Posted By:   Benoit_Quintin  
Posted On:   Tuesday, February 11, 2003 06:50 AM

No, an object is thread unsafe when it is a shared resource amongst competing threads and no synchonisation and/or semaphores are implemented. Vector is thread safe, because when some thread is reading the vector, another thread cannot come and modify the same vector. As I said before, it helps for ANY shared resource, be it file I/O, Database connections, etc.
About | Sitemap | Contact