2001-04-12 Ulrich Drepper <drepper@redhat.com>
+ * tst-cancel.c: Disable most tests. Add new test where all
+ cleanup handlers must run.
+ * Makefile (tests): Add tst-cancel again.
+
+ * cancel.c (__pthread_perform_cleanup): Correct condition for
+ leaving cleanup loop early.
+
* sysdeps/i386/Makefile: Make sure gcc uses a frame pointer for
all the files which use CURRENT_STACK_FRAME.
-
* sysdeps/i386/pt-machine.h (CURRENT_STACK_FRAME): Define using
__builtin_frame_address.
* sysdeps/i386/i686/pt-machine.h: Likewise.
}
+static void *
+t3 (void *arg)
+{
+ pthread_cleanup_push (cleanupok, (void *) (long int) 4);
+ inner ((int) (long int) arg);
+ pthread_exit (NULL);
+ pthread_cleanup_pop (0);
+}
+
+
static void
innerok (int a)
{
- pthread_cleanup_push (cleanup, (void *) (long int) a);
- if (a)
- return;
+ pthread_cleanup_push (cleanupok, (void *) (long int) a);
+ pthread_exit (NULL);
pthread_cleanup_pop (0);
}
static void *
-t3 (void *arg)
+t4 (void *arg)
{
- pthread_cleanup_push (cleanupok, (void *) (long int) 4);
+ pthread_cleanup_push (cleanupok, (void *) (long int) 6);
innerok ((int) (long int) arg);
- pthread_exit (NULL);
pthread_cleanup_pop (0);
+ return NULL;
}
pthread_t td;
int err;
char *tmp;
- const char *path;
+ const char *prefix;
const char template[] = "thtstXXXXXX";
struct stat64 st;
int result = 0;
- path = argc > 1 ? argv[1] : "";
- tmp = (char *) alloca (strlen (path) + sizeof template);
- strcpy (stpcpy (tmp, path), template);
+ prefix = argc > 1 ? argv[1] : "";
+ tmp = (char *) alloca (strlen (prefix) + sizeof template);
+ strcpy (stpcpy (tmp, prefix), template);
fd = mkstemp (tmp);
if (fd == -1)
exit (1);
}
+#ifdef NOT_YET
err = pthread_create (&td, NULL, t1, NULL);
if (err != 0)
{
printf ("cannot join thread: %s\n", strerror (err));
exit (1);
}
+#endif
+
+ err = pthread_create (&td, NULL, t4, (void *) 7);
+ if (err != 0)
+ {
+ printf ("cannot create thread t3: %s\n", strerror (err));
+ exit (1);
+ }
+
+ err = pthread_join (td, NULL);
+ if (err != 0)
+ {
+ printf ("cannot join thread: %s\n", strerror (err));
+ exit (1);
+ }
if (fstat64 (fd, &st) < 0)
{
result = 1;
}
- if (cleanupokcnt != 1)
+ // if (cleanupokcnt != 3) will be three once t3 runs
+ if (cleanupokcnt != 2)
{
printf ("cleanupokcnt = %d\n", cleanupokcnt);
result = 1;