1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-26 00:57:39 +01:00

(doit): Set stack-size attribute to increase likelihood that we're able

to create NTHREADS threads.  With NTHREADS==128 and the stack-size
	rlimit set to "unlimited", the test is otherwise likely to fail because
	on ia64 it will default to using 32MB of stack per thread.

(Logical change 1.291)
This commit is contained in:
hp.com!davidm 2005-05-05 09:23:46 +00:00
parent 23884c98cb
commit b0406d0a2a

View file

@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#endif #endif
#include <libunwind.h> #include <libunwind.h>
#include <limits.h>
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
@ -81,10 +82,14 @@ static void
doit (void) doit (void)
{ {
pthread_t th[NTHREADS]; pthread_t th[NTHREADS];
pthread_attr_t attr;
int i; int i;
pthread_attr_init (&attr);
pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN + 64*1024);
for (i = 0; i < NTHREADS; ++i) for (i = 0; i < NTHREADS; ++i)
if (pthread_create (th + i, NULL, worker, NULL)) if (pthread_create (th + i, &attr, worker, NULL))
{ {
fprintf (stderr, "FAILURE: Failed to create %u threads " fprintf (stderr, "FAILURE: Failed to create %u threads "
"(after %u threads)\n", "(after %u threads)\n",