diff options
Diffstat (limited to 'pr/tests/attach.c')
-rw-r--r-- | pr/tests/attach.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/pr/tests/attach.c b/pr/tests/attach.c index 4b890063..980fd6d4 100644 --- a/pr/tests/attach.c +++ b/pr/tests/attach.c @@ -36,15 +36,6 @@ ** 12-June-97 Revert to return code 0 and 1. ***********************************************************************/ -#ifdef XP_BEOS -#include <stdio.h> -int main() -{ - printf( "This test currently does not run on BeOS\n" ); - return 0; -} -#else - /*********************************************************************** ** Includes ***********************************************************************/ @@ -74,6 +65,8 @@ int main() #define INCL_ERRORS #include <os2.h> #include <process.h> +#elif defined(XP_BEOS) +#include <kernel/OS.h> #endif #define DEFAULT_COUNT 1000 @@ -125,6 +118,8 @@ static void Measure(void (*func)(void), const char *msg) static unsigned __stdcall threadStartFunc(void *arg) #elif defined(IRIX) && !defined(_PR_PTHREADS) static void threadStartFunc(void *arg) +#elif defined(XP_BEOS) +static int32 threadStartFunc(void *arg) #else static void * threadStartFunc(void *arg) #endif @@ -165,6 +160,10 @@ int main(int argc, char **argv) #elif defined(OS2) int rv; TID threadID; +#elif defined(XP_BEOS) + thread_id threadID; + int32 threadRV; + status_t waitRV; #endif /* The command line argument: -d is used to determine if the test is being run @@ -328,6 +327,28 @@ int main(int argc, char **argv) goto exit_now; } +#elif defined(XP_BEOS) + + threadID = spawn_thread(threadStartFunc, NULL, B_NORMAL_PRIORITY, NULL); + if (threadID <= B_ERROR) { + fprintf(stderr, "thread creation failed: error code %08lx\n", threadID); + failed_already = 1; + goto exit_now; + } + if (resume_thread(threadID) != B_OK) { + fprintf(stderr, "failed starting thread: error code %08lx\n", threadID); + failed_already = 1; + goto exit_now; + } + + waitRV = wait_for_thread(threadID, &threadRV); + if (debug_mode) + PR_ASSERT(waitRV == B_OK); + else if (waitRV != B_OK) { + failed_already = 1; + goto exit_now; + } + #else if (!debug_mode) failed_already=1; @@ -344,5 +365,3 @@ exit_now: else return 0; } - -#endif /* XP_BEOS */ |