2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
16 static int64 sHandledSignals
= 0;
20 signal_pusher(void* data
)
23 get_team_info(B_CURRENT_TEAM
, &teamInfo
);
24 thread_id mainThread
= teamInfo
.team
;
27 send_signal(mainThread
, SIGUSR1
);
36 signal_handler(int signal
)
43 allocator_thread(int level
)
48 free(malloc(rand() % 10000));
50 allocator_thread(level
+ 1);
57 // Test program to reproduce bug #2562. Is finished quickly and must be run
58 // in a loop to reproduce the bug.
60 // install signal handler
61 if (signal(SIGUSR1
, signal_handler
) == SIG_ERR
) {
62 fprintf(stderr
, "Error: Failed to install signal handler: %s\n",
67 // start signal thread
68 thread_id signalThread
= spawn_thread(&signal_pusher
, "signal pusher",
69 B_NORMAL_PRIORITY
, NULL
);
70 resume_thread(signalThread
);
74 kill_thread(signalThread
);
77 printf("test successful, handled %lld signals\n", sHandledSignals
);