delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/07/08:43:35

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
Message-ID: <B9095DA2D217D511929B00A0C94989FE01C71F@obelix.askesis.nl>
From: Joost Kraaijeveld <J DOT Kraaijeveld AT Askesis DOT nl>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: pthread_create problem in Cygwin 1.1.8-2
Date: Sat, 7 Apr 2001 14:36:44 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Why does this code crash with the try/catch and not without the try/catch?

Compiled and linked with:
g++ -c -mthreads -g -O0 -Wall   -o"Main.o" Main.cpp
g++ -mthreads  -o./ALibTest.exe Main.o

// Main.cpp
#include <pthread.h>
#include <windows.h>
#include <stdio.h>

void* threadFunction(void * arg)
{
   try
   {
      for ( unsigned long i = 0;i<100;i++)
      {
         printf("%lu\n",i);
      }
      return 0;
   }
   catch(...)
   {
   }
   return 0;
}

int main()
{
  pthread_t t1;
  pthread_t t2;

  pthread_create(&t1, NULL, threadFunction, NULL);
  pthread_create(&t2, NULL, threadFunction, NULL);

  Sleep(3000); // No semaphore but a simple wait

  return 0;
}

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
email: J DOT Kraaijeveld AT Askesis DOT nl
web: www.askesis.nl 



--
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