On Thu, 06 Nov 2008, Przemyslaw Czerpak wrote:

Hi David,

> Now we should resolve the problem with creating new threads in OS2
> OpenWatcom() looks that sth is wrong and the problem is not inside
> Harbour but OpenWatcom MT CRTL. Or maybe it's a trivial problem with
> calling convention and expected startup parameters. I can try to add
> workaround and create new thread using only OS2 API but it would be
> good if someone who knows C and uses OS2 will make some tests with
> OS2 OpenWatcom small MT C programs to find real reason.

Please try to compile and link the code below using OS2-OpenWatcom
and send here the results. Maybe it will help us to locate what is
wrong.

best regards,
Przemek


/* ************************************************************ */
#define INCL_DOSSEMAPHORES
#define INCL_DOSPROCESS
#include "hbthread.h"

static HB_THREAD_STARTFUNC( thFunc )
{
   printf( "This is thread function [%p] !!!\n", Cargo );
   HB_THREAD_END
}

int main( void )
{
   HB_THREAD_ID th_id;
   void * Cargo = ( void * ) 0x12345678;

   printf( "Starting thread...\n" );
#if defined( HB_PTHREAD_API )
   if( pthread_create( &th_id, NULL, thFunc, Cargo ) != 0 )
      th_id = ( HB_THREAD_ID ) 0;
#else
   th_id = _beginthread( thFunc, NULL, 128 * 1024, Cargo );
#endif
   printf( "thread id = %p\n", ( void * ) th_id );

#if defined( HB_PTHREAD_API )
   pthread_join( th_id, NULL );
#else
   DosWaitThread( &th_id, DCWW_WAIT );
#endif
   printf( "Done\n" );
   return 0;
}
/* ************************************************************ */
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to