From 6eb5bba145940501ca972e4243d7417c8120d569 Mon Sep 17 00:00:00 2001 From: rpj Date: Sun, 6 Aug 2000 12:15:47 +0000 Subject: 2000-08-06 Ross Johnson * pthread.h: Remove #warning - VC++ doesn't accept it. 2000-08-05 Ross Johnson * pthread.h (PtW32CatchAll): Add macro. When compiling applications using VC++ with C++ EH rather than SEH 'PtW32CatchAll' must be used in place of any 'catch( ... )' if the application wants pthread cancelation or pthread_exit() to work. 2000-08-03 Ross Johnson * pthread.h: Add a base class Pthread_exception for library internal exceptions and change the "catch" re-define macro to use it. 2000-08-02 Ross Johnson * GNUmakefile (CFLAGS): Add -mthreads. Add new targets to generate cpp and asm output. * sync.c (pthread_join): Remove dead code. tests: 2000-08-06 Ross Johnson * ccl.bat: Add /nologo to remove extraneous output. * exception1.c (exceptionedThread): Init 'dummy'; put expression into if condition to prevent optimising away; remove unused variable. * cancel4.c (mythread): Cast return value to avoid warnings. * cancel2.c (mythread): Missing #endif. * condvar9.c (mythread): Cast return value to avoid warnings. * condvar8.c (mythread): Cast return value to avoid warnings. * condvar7.c (mythread): Cast return value to avoid warnings. * cleanup3.c (mythread): Cast return value to avoid warnings. * cleanup2.c (mythread): Cast return value to avoid warnings. * cleanup1.c (mythread): Cast return value to avoid warnings. * condvar5.c (mythread): Cast return value to avoid warnings. * condvar3.c (mythread): Cast return value to avoid warnings. * condvar6.c (mythread): Cast return value to avoid warnings. * condvar4.c (mythread): Cast return value to avoid warnings. 2000-08-05 Ross Johnson * cancel2.c: Use PtW32CatchAll macro if defined. * exception1.c: Use PtW32CatchAll macro if defined. 2000-08-02 Ross Johnson * tsd1.c: Fix typecasts of &result [g++ is now very fussy]. * test.h (assert): Return 0's explicitly to allay g++ errors. * join2.c: Add explicit typecasts. * join1.c: Add explicit typecasts. * join0.c: Add explicit typecasts. * eyal1.c: Add explicit typecasts. * count1.c (main): Add type cast to remove g++ parse warning [gcc-2.95.2 seems to have tightened up on this]. * Makefile (GLANG): Use c++ explicitly. Remove MSVC sections (was commented out). Add target to generate cpp output. --- tests/exception1.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'tests/exception1.c') diff --git a/tests/exception1.c b/tests/exception1.c index a7d8e22..eddd8fb 100644 --- a/tests/exception1.c +++ b/tests/exception1.c @@ -56,7 +56,7 @@ exceptionedThread(void * arg) int result = ((int)PTHREAD_CANCELED + 1); int one = 1; int zero = 0; - int dummy; + int dummy = 0; /* Set to async cancelable */ @@ -66,22 +66,32 @@ exceptionedThread(void * arg) Sleep(100); -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__cplusplus) __try { - dummy = one/zero; + /* Avoid being optimised out */ + if (dummy == one/zero) + Sleep(0); } __except (EXCEPTION_EXECUTE_HANDLER) { + /* Should get into here. */ result = ((int)PTHREAD_CANCELED + 2); } #elif defined(__cplusplus) try { - dummy = one/zero; + /* Avoid being optimised out */ + if (dummy == one/zero) + Sleep(0); } +#if defined(PtW32CatchAll) + PtW32CatchAll +#else catch (...) +#endif { + /* Should get into here. */ result = ((int)PTHREAD_CANCELED + 2); } #endif @@ -93,7 +103,6 @@ void * canceledThread(void * arg) { int result = ((int)PTHREAD_CANCELED + 1); - int dummy; int count; /* Set to async cancelable */ @@ -102,7 +111,7 @@ canceledThread(void * arg) assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0); -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__cplusplus) __try { /* @@ -114,6 +123,7 @@ canceledThread(void * arg) } __except (EXCEPTION_EXECUTE_HANDLER) { + /* Should NOT get into here. */ result = ((int)PTHREAD_CANCELED + 2); } #elif defined(__cplusplus) @@ -126,8 +136,13 @@ canceledThread(void * arg) for (count = 0; count < 100; count++) Sleep(100); } +#if defined(_MSC_VER) + AltCatchAll +#else catch (...) +#endif { + /* Should NOT get into here. */ result = ((int)PTHREAD_CANCELED + 2); } #endif -- cgit v1.2.3