This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
RE: pthread_t definiton and STL...
- To: 'Ales Pour' <pour at princip dot cz>
- Subject: RE: pthread_t definiton and STL...
- From: "Bossom, John" <John dot Bossom at Cognos dot COM>
- Date: Thu, 11 Jan 2001 10:04:22 -0500
- Cc: pthreads-win32 at sources dot redhat dot com
The "implement.h" is purposely separated from "pthread.h" to obscure the
implementation from the users.
pthread_t is defined to be a pointer to a structure that is not
defined for the users. It is only defined for the implementation.
This isolates the user's from changes to the implementation.
The reason pthread_t is defined as
typedef struct pthread_t_ * pthread_t;
is to permit strong type checking of the pointer without defining the
actual struct, itself. The C compiler allows you to have a pointer
to an undefined type so long as you do not dereference the pointer
in your code.
Including "implement.h" into pthread.h breaks these gains.
What error are you getting from the system?
-----Original Message-----
From: Ales Pour [mailto:pour@princip.cz]
Sent: January 11, 2001 9:05 AM
Cc: pthreads-win32@sources.redhat.com
Subject: pthread_t definiton and STL...
Hello,
I'm having a tiny trouble with pthread_t type definition since I've been
using this _great_ library.
The following code doesn't compile with VC5 (SP3) using SGI's STL:
#include <vector>
using namespace std;
#include "pthread.h"
int main()
{
vector<pthread_t> _v;
return 0;
}
VC complains:
...\include\stl\stl_construct.h(58) : error C2027: use of undefined type
'pthread_t_'
I fix this problem by adding '#include "implement.h"' to pthread.h ...
Now I wonder if there's better way to avoid this error.
Thank you a lot.
Ales Pour
--------------
Ales Pour
Princip a.s.
Czech Republic