btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / tests / system / kernel / port_wakeup_test_5.cpp
blob480560ec2a766f95a5c1546410f95b671e898309
1 /*
2 * Copyright 2006, Marcus Overhagen, <marcus@overhagen.de>
3 * Distributed under the terms of the MIT License.
4 */
7 #include <OS.h>
8 #include <stdio.h>
9 #include <string.h>
16 port_id id;
17 char data[100];
19 int32
20 test_thread(void *)
22 status_t s;
24 printf("write port...\n");
25 s = write_port(id, 0x5678, data, 20);
26 printf("write port result 0x%08lx (%s)\n", s, strerror(s));
28 return 0;
32 int
33 main()
35 status_t s;
37 id = create_port(1, "test port");
38 printf("created port %ld\n", id);
40 s = write_port(id, 0x1234, data, 10);
41 printf("write port result 0x%08lx (%s)\n", s, strerror(s));
43 printf("write should block for 5 seconds now, as port is full, until port is deleted\n");
45 thread_id thread = spawn_thread(test_thread, "test thread", B_NORMAL_PRIORITY, NULL);
46 resume_thread(thread);
47 snooze(5000000);
49 printf("delete port...\n");
50 s = delete_port(id);
51 printf("delete port result 0x%08lx (%s)\n", s, strerror(s));
53 printf("waiting for thread to terminate\n");
54 wait_for_thread(thread, &s);
56 return 0;