aboutsummaryrefslogtreecommitdiff
path: root/tinycc/tests/tests2/116_bound_setjmp2.c
diff options
context:
space:
mode:
authorUneven Prankster <unevenprankster@protonmail.com>2023-07-17 01:34:34 -0300
committerUneven Prankster <unevenprankster@protonmail.com>2023-07-17 01:34:34 -0300
commit88d82c6eaee88398af1de57cddca692a1f74b087 (patch)
treedf492c2002a1820959703f4f481172cceafeb0a1 /tinycc/tests/tests2/116_bound_setjmp2.c
parent111c133b939c15c57c90cd474d55e84928c6307a (diff)
Cleanup feels good! Big work coming up this week.
Diffstat (limited to 'tinycc/tests/tests2/116_bound_setjmp2.c')
-rw-r--r--tinycc/tests/tests2/116_bound_setjmp2.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/tinycc/tests/tests2/116_bound_setjmp2.c b/tinycc/tests/tests2/116_bound_setjmp2.c
deleted file mode 100644
index 151114d..0000000
--- a/tinycc/tests/tests2/116_bound_setjmp2.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <setjmp.h>
-#if !defined(_WIN32)
-#include <pthread.h>
-#else
-#include <windows.h>
-#endif
-
-#define SIZE 10
-#define COUNT 10
-
-#define TST int i, a[2], b[2]; \
- for (i = 0; i < 2; i++) a[i] = 0; \
- for (i = 0; i < 2; i++) b[i] = 0
-
-static int count[SIZE];
-
-static void tst1 (jmp_buf loc)
-{
- TST;
- longjmp(loc, 1);
-}
-
-static void tst2(jmp_buf loc)
-{
- jmp_buf jmp;
-
- setjmp (jmp);
- TST;
- tst1(loc);
-}
-
-static void *tst (void * index)
-{
- jmp_buf loc;
- int i = *(int *) index;
- static int v[SIZE];
-
- for (v[i] = 0; v[i] < COUNT; v[i]++) {
- if (setjmp (loc) == 0) {
- TST;
- tst2(loc);
- }
- else {
- count[i]++;
- }
- i = *(int *) index;
- }
- return NULL;
-}
-
-int
-main (void)
-{
- int i;
-#if !defined(_WIN32)
- pthread_t id[SIZE];
-#else
- HANDLE id[SIZE];
-#endif
- int index[SIZE];
-
- for (i = 0; i < SIZE; i++) {
- index[i] = i;
-#if !defined(_WIN32)
- pthread_create (&id[i], NULL, tst, (void *) &index[i]);
-#else
- id[i] = CreateThread(NULL, 8192, (LPTHREAD_START_ROUTINE) tst, (void *) &index[i], 0, NULL);
-#endif
- }
- for (i = 0; i < SIZE; i++) {
-#if !defined(_WIN32)
- pthread_join (id[i], NULL);
-#else
- WaitForSingleObject(id[i], INFINITE);
-#endif
- }
- for (i = 0; i < SIZE; i++) {
- if (count[i] != COUNT)
- printf ("error: %d %d\n", i, count[i]);
- }
- return 0;
-}