Board index » cppbuilder » using STL library

using STL library


2004-01-05 04:02:31 PM
cppbuilder105
Hello!
My question is a little general...
For example I create queue object of STL library.
Question:
Is this object of STL library protected and I can access to data with many
threads?
Thanks a lot.
Luba
 
 

Re:using STL library

Hello again!
I found some information in STLport library..
C++ Builder 6 has different build configurations.
How I can switch between those configuration?
For example between single-threaded and multi-threaded configuration?
Thanks.
"LR" < XXXX@XXXXX.COM >wrote in message
Quote
Hello!
My question is a little general...
For example I create queue object of STL library.
Question:
Is this object of STL library protected and I can access to data with many
threads?
Thanks a lot.
Luba


 

Re:using STL library

Hi!
LR wrote:
Quote
Hello again!
I found some information in STLport library..
C++ Builder 6 has different build configurations.
How I can switch between those configuration?
For example between single-threaded and multi-threaded configuration?
The option for single threaded and multithreaded programs does not
affect the STL library at all. STL is single threaded only, i.e. in a
multithreaded program it is your responsability that no two threads
access the same object at the same time.
Frank
 

{smallsort}

Re:using STL library

"LR" < XXXX@XXXXX.COM >writes:
Quote
Hello again!
I found some information in STLport library..
C++ Builder 6 has different build configurations.
How I can switch between those configuration?
For example between single-threaded and multi-threaded configuration?
Thanks.
I think VCL applications are always (or should be) MT. I don't know
of a toggle switch in the IDE, but you need to at least tell the
compiler you're MT with command line argument -tWM (from memory, so I
might be slightly off). Also, you should define (under
conditionals/definitions under compiler options) _MT if it's not
defined.
Note, you are still required to use some locking mechanism to share a
resource between two threads. If you don't lock, you can still run
into trouble, "even" with STL objects.
--
Chris (TeamB);