1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2001-04-11  Ulrich Drepper  <drepper@redhat.com>

	* tst-cancel.c (main): Cleanup 4 is supposed to run.  Create
	temporary file in object directory.
	* Makefile: Don't allow inlining when compiling tst-cancel.c.
	Pass $(objpfx) to tst-cancel.
This commit is contained in:
Ulrich Drepper
2001-04-12 02:29:04 +00:00
parent 43df859b95
commit 7d4c3e67b4
3 changed files with 46 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2001-04-11 Ulrich Drepper <drepper@redhat.com>
* tst-cancel.c (main): Cleanup 4 is supposed to run. Create
temporary file in object directory.
* Makefile: Don't allow inlining when compiling tst-cancel.c.
Pass $(objpfx) to tst-cancel.
2001-04-11 David S. Miller <davem@redhat.com> 2001-04-11 David S. Miller <davem@redhat.com>
* sysdeps/sparc/sparc32/pt-machine.h (stack_pointer): Advance * sysdeps/sparc/sparc32/pt-machine.h (stack_pointer): Advance

View File

@ -44,6 +44,9 @@ LDFLAGS-pthread.so = $(nodelete-$(have-z-nodelete)) \
vpath %.c Examples vpath %.c Examples
tst-cancel-ARGS = "$(objpfx)"
CFLAGS-tst-cancel.c = -fno-inline
include ../Makeconfig include ../Makeconfig
ifeq ($(build-shared),yes) ifeq ($(build-shared),yes)

View File

@ -25,6 +25,15 @@ cleanup (void *arg)
} }
volatile int cleanupokcnt;
static void
cleanupok (void *arg)
{
++cleanupokcnt;
}
static void * static void *
t1 (void *arg) t1 (void *arg)
{ {
@ -54,25 +63,41 @@ t2 (void *arg)
} }
static void
innerok (int a)
{
pthread_cleanup_push (cleanup, (void *) (long int) a);
if (a)
return;
pthread_cleanup_pop (0);
}
static void * static void *
t3 (void *arg) t3 (void *arg)
{ {
pthread_cleanup_push (cleanup, (void *) (long int) 4); pthread_cleanup_push (cleanupok, (void *) (long int) 4);
inner ((int) (long int) arg); innerok ((int) (long int) arg);
pthread_exit (NULL); pthread_exit (NULL);
pthread_cleanup_pop (0); pthread_cleanup_pop (0);
} }
int int
main (void) main (int argc, char *argv[])
{ {
pthread_t td; pthread_t td;
int err; int err;
char tmp[] = "thtstXXXXXX"; char *tmp;
const char *path;
const char template[] = "thtstXXXXXX";
struct stat64 st; struct stat64 st;
int result = 0; int result = 0;
path = argc > 1 ? argv[1] : "";
tmp = (char *) alloca (strlen (path) + sizeof template);
strcpy (stpcpy (tmp, path), template);
fd = mkstemp (tmp); fd = mkstemp (tmp);
if (fd == -1) if (fd == -1)
{ {
@ -140,6 +165,7 @@ main (void)
char buf[512]; char buf[512];
puts ("some cleanup handlers ran:"); puts ("some cleanup handlers ran:");
fflush (stdout); fflush (stdout);
__lseek (fd, 0, SEEK_SET);
while (1) while (1)
{ {
ssize_t n = read (fd, buf, sizeof buf); ssize_t n = read (fd, buf, sizeof buf);
@ -150,5 +176,11 @@ main (void)
result = 1; result = 1;
} }
if (cleanupokcnt != 1)
{
printf ("cleanupokcnt = %d\n", cleanupokcnt);
result = 1;
}
return result; return result;
} }