This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: pthread_create problem in Cygwin 1.1.8-2
- To: Joost Kraaijeveld <J dot Kraaijeveld at Askesis dot nl>
- Subject: Re: pthread_create problem in Cygwin 1.1.8-2
- From: Earnie Boyd <earnie_boyd at yahoo dot com>
- Date: Sun, 08 Apr 2001 08:22:23 -0400
- CC: "'cygwin at cygwin dot com'" <cygwin at cygwin dot com>
- References: <B9095DA2D217D511929B00A0C94989FE01C71F@obelix.askesis.nl>
- Reply-To: Earnie Boyd <cygwin at cygwin dot com>
Joost Kraaijeveld wrote:
>
> Why does this code crash with the try/catch and not without the try/catch?
>
Don't know; works for me:
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/gcc-2.95.2-9/specs
gcc version gcc-2.95.2-9 19991024 (cygwin experimental)
> 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.Kraaijeveld@Askesis.nl
> web: www.askesis.nl
>
> --
> Want to unsubscribe from this list?
> Check out: http://cygwin.com/ml/#unsubscribe-simple
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple