How to use pthread_alloc

A

Abhi

I am trying to use pthread_allocator for a multi-threaded code.
However it does not seem to compile.

Heres the code snippet:

#include <list>
#include <bits/pthread_allocimpl.h>


using namespace std;

int main(int argc, char* argv[] )
{
std::list<int, std::pthread_allocator<int> > List;
for ( int i=0; i<100000; ++i )
List.push_back( int() );
}


The version of g++ is
....
Configured with: ../gcc-3.0.4/configure
--prefix=/prj/qisdcrm/QChat/gcc-3.0.4-Linux --enable-threads
Thread model: posix
gcc version 3.0.4


Guess I am doing something gravely wrong!
Thanks
......Abhi
 
A

Artie Gold

Abhi said:
I am trying to use pthread_allocator for a multi-threaded code.
However it does not seem to compile.

Heres the code snippet:

#include <list>
#include <bits/pthread_allocimpl.h>


using namespace std;

int main(int argc, char* argv[] )
{
std::list<int, std::pthread_allocator<int> > List;
for ( int i=0; i<100000; ++i )
List.push_back( int() );
}


The version of g++ is

...
Configured with: ../gcc-3.0.4/configure
--prefix=/prj/qisdcrm/QChat/gcc-3.0.4-Linux --enable-threads
Thread model: posix
gcc version 3.0.4

Since standard C++ does not deal with threading at all, you're off topic
in
[followups set]

HTH,
--ag
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,113
Messages
2,570,690
Members
47,269
Latest member
VitoYwo03

Latest Threads

Top