delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/06/21/18:19:53

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Thu, 21 Jun 2001 10:55:20 -0700 (PDT)
Message-Id: <20010621.105520.60852578.Takaaki.Ota@am.sony.com>
To: cygwin AT cygwin DOT com
Subject: pthread
From: Tak Ota <Takaaki DOT Ota AT am DOT sony DOT com>
X-Mailer: Mew version 1.95b126 on Emacs 21.0.103.1 / Mule 5.0 (SAKAKI)
X-Telephone: +1-858-942-3239
X-Fax------: +1-858-942-9142
X-SnailMail: 16450 West Bernardo Drive MZ7205, San Diego, CA 92127-1804
Organization: Sony Electronics Inc.
Mime-Version: 1.0

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.

-Tak

------------------------------------------------------------------
#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: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019