mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-26 09:07:38 +01:00
(doit): Fail gracefully if we fail to create all NTHREADS threads.
(Logical change 1.290)
This commit is contained in:
parent
e8b25005e7
commit
c0e81195b7
1 changed files with 12 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* libunwind - a platform-independent unwind library
|
/* libunwind - a platform-independent unwind library
|
||||||
Copyright (C) 2003-2004 Hewlett-Packard Co
|
Copyright (C) 2003-2005 Hewlett-Packard Co
|
||||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
@ -84,7 +84,13 @@ doit (void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < NTHREADS; ++i)
|
for (i = 0; i < NTHREADS; ++i)
|
||||||
pthread_create (th + i, NULL, worker, NULL);
|
if (pthread_create (th + i, NULL, worker, NULL))
|
||||||
|
{
|
||||||
|
fprintf (stderr, "FAILURE: Failed to create %u threads "
|
||||||
|
"(after %u threads)\n",
|
||||||
|
NTHREADS, i);
|
||||||
|
exit (-1);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < NTHREADS; ++i)
|
for (i = 0; i < NTHREADS; ++i)
|
||||||
pthread_join (th[i], NULL);
|
pthread_join (th[i], NULL);
|
||||||
|
@ -110,7 +116,10 @@ main (int argc, char **argv)
|
||||||
unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
|
unw_set_caching_policy (unw_local_addr_space, UNW_CACHE_PER_THREAD);
|
||||||
|
|
||||||
if (nerrors)
|
if (nerrors)
|
||||||
|
{
|
||||||
fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
|
fprintf (stderr, "FAILURE: detected %d errors\n", nerrors);
|
||||||
|
exit (-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf ("SUCCESS\n");
|
printf ("SUCCESS\n");
|
||||||
|
|
Loading…
Reference in a new issue