Tak Ota
Thu Jun 21 10:55:00 GMT 2001

Hello all,

I just subscribed to the list yesterday.  So excuse me if the
following has already been discussed before.

I'm trying to exercise pthread on cyginw.  Following is the code I am
trying to run.  It compiles fine but when it runs I am expecting to
see "Hello World" output but actually see nothing printed.  The same
code was tested under Linux and it ran as expected.  Could anyone tell
me what I am doing wrong here?  Thanks in advance.


#include <stdio.h>
#include <pthread.h>

void print_message_function( void *ptr )
  char *message;
  message = (char *) ptr;
  fprintf(stderr, "%s ", message);

int main(int argc, char **argv)
  pthread_t thread1 = 0, thread2 = 0;
  char *message1 = "Hello";
  char *message2 = "World";

  pthread_create(&thread1, NULL,
                 (void*)&print_message_function, (void*) message1);
  pthread_create(&thread2, NULL, 
                 (void*)&print_message_function, (void*) message2);
  return 0;

Want to unsubscribe from this list?
Check out:

More information about the Cygwin mailing list