Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
What's the connection between objects and threads?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="James Kanze, post: 3551763"] Common use by whom? The Wikipedia isn't exactly what I would call a reference. There are a lot of people who seem to think that "thread safety" means that the programmer doesn't have to do anything, and that everything will just magically work. Such thread safety doesn't exist in the real world, however; such a definition is useless; and I don't know of any competent person who would use it. Which is rather ambiguous. What is meant by "simultaneous execution"? The code in the allocators of an STL vector cannot normally be executed simultaneously by multiple threads, but certainly you wouldn't consider STL vector to not be thread safe because it uses some sort of protection interally to ensure that it doesn't execute simultaneously. And if you follow the rules laid down by SGI (which are basically those of Posix), all of the functions in their implementation work in a multithreaded environment. (Roughly speaking, SGI uses the same definition as Posix. Except that I don't think that any of the functions in their implementation of the library are not thread safe, where as in Posix, things like localtime, etc. are not thread safe.) If that's what the article actually says, then it's off base. One can talk of different degrees of thread safety (although I don't like the expression), with different types of guarantees, but when you say that a function is not thread-safe, at all, you mean something like localtime, which isn't thread safe and cannot be used at all in a multithreaded environment. And if you call the SGI implementation of std::vector "not thread-safe", what do you call something like localtime? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
What's the connection between objects and threads?
Top