This is the mail archive of the
mailing list for the pthreas-win32 project.
Re: Borland C++Builder support
Will Bryant wrote:
Gianluca wrote:There are pthreads implementations that allow a NULL thread
parameter (Solaris - see below) and the question of a NULL
value has been asked before on this list. My copy of the
SUSV3 standard doesn't say that NULL can't be passed and
doesn't require an error be returned. It appears to be left
to the implementation.
I have built the library with the Will Bryant's bmakefile.In general (ie. not for pthreads-win32 specifically), you need to
declare a pthread_id_t and pass it's address as the first argument to
pthread_create. Try making that change first.
I've received a bunch of warnings but it was OK.
I put the PthreadBC.dll on Windows directory, I included
PthreadBC.lib in my .bpr project, I compiled and linked the program
void* function( void* arg )
printf( "This is thread %d\n", pthread_self() );
return( 0 );
int main( void )
pthread_attr_init( &attr );
&attr, PTHREAD_CREATE_DETACHED );
pthread_create( NULL, &attr, &function, NULL );
In pthreads-win32, a memory protection fault is raised if
NULL is passed, but it also starts the thread before the
fault is raised, which is probably a bug.
I've run the following test on machines that I have access to:
thr(void * arg)
/* Mandatory if we're going to be well behaved. */
int result = 0;
result == pthread_create(NULL, NULL, thr, NULL);
Linux (Redhat 9) segfaults without running the thread.
Solaris 7 runs the thread and exits with no error or fault.
Pthreads-win32 could probably emulate Solaris with a one
line change. The question is:- which behaviour is preferrable?