summaryrefslogtreecommitdiff
path: root/tests/cleanup1.c
diff options
context:
space:
mode:
authorrpj <rpj>2002-02-02 23:15:28 +0000
committerrpj <rpj>2002-02-02 23:15:28 +0000
commit4a72430d821b96add23846980d07f5a01059029d (patch)
tree6601b116e591db28feaed15a92ae46bfed8197da /tests/cleanup1.c
parent6a65a568fa4d9515265842c8bcf11a7449f3c325 (diff)
* cancel.c: Rearranged some code and introduced checks
to disable cancelation at the start of a thread's cancelation run to prevent double cancelation. The main problem arises if a thread is canceling and then receives a subsequent async cancel request. * private.c: Likewise. * condvar.c: Place pragmas around cleanup_push/pop to turn off inline optimisation (/Obn where n>0 - MSVC only). Various optimisation switches in MSVC turn this on, which interferes with the way that cleanup handlers are run in C++ EH and SEH code. Application code compiled with inline optimisation must also wrap cleanup_push/pop blocks with the pragmas, e.g. #pragma inline_depth(0) pthread_cleanup_push(...) ... pthread_cleanup_pop(...) #pragma inline_depth(8) * rwlock.c: Likewise. * mutex.c: Remove attempts to inline some functions. * signal.c: Modify misleading comment. tests/ * mutex8: New test. * mutex8n: New test. * mutex8e: New test. * mutex8r: New test. * cancel6a: New test. * cancel6d: New test. * cleanup0.c: Add pragmas for inline optimisation control. * cleanup1.c: Add pragmas for inline optimisation control. * cleanup2.c: Add pragmas for inline optimisation control. * cleanup3.c: Add pragmas for inline optimisation control. * condvar7.c: Add pragmas for inline optimisation control. * condvar8.c: Add pragmas for inline optimisation control. * condvar9.c: Add pragmas for inline optimisation control.
Diffstat (limited to 'tests/cleanup1.c')
-rw-r--r--tests/cleanup1.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/cleanup1.c b/tests/cleanup1.c
index 2b2ffe4..52a67c7 100644
--- a/tests/cleanup1.c
+++ b/tests/cleanup1.c
@@ -89,6 +89,7 @@ static void
#ifdef __CLEANUP_C
__cdecl
#endif
+
increment_pop_count(void * arg)
{
int * c = (int *) arg;
@@ -112,6 +113,9 @@ mythread(void * arg)
assert(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL) == 0);
+#ifdef _MSC_VER
+#pragma inline_depth(0)
+#endif
pthread_cleanup_push(increment_pop_count, (void *) &pop_count);
/*
* We don't have true async cancelation - it relies on the thread
@@ -123,6 +127,9 @@ mythread(void * arg)
Sleep(100);
pthread_cleanup_pop(0);
+#ifdef _MSC_VER
+#pragma inline_depth(8)
+#endif
return (void *) result;
}