Changeset af28af6 in mainline
- Timestamp:
- 2025-03-06T14:59:37Z (3 days ago)
- Children:
- 88cbc66
- Parents:
- 25ee7ec5
- Location:
- uspace/lib
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/test/fibril/exit_hook.c
r25ee7ec5 raf28af6 58 58 } 59 59 60 /* 61 * static errno_t fibril_to_be_killed(void* _arg) { 62 * fibril_add_exit_hook(exit_hook); 63 * 64 * while (true) 65 * firbil_yield(); 66 * 67 * assert(0 && "unreachable"); 68 * } 69 * 70 * PCUT_TEST(exit_hook_kill) { 71 * value = 0; 72 * fid_t other = fibril_create(fibril_to_be_killed, NULL); 73 * fibril_start(other); 74 * 75 * fibril_yield(); 76 * 77 * fibril_kill(other); // anything like this doesn't exist yet 78 * 79 * PCUT_ASSERT_INT_EQUALS(5, value); 80 * } 81 */ 60 static errno_t fibril_explicit_exit(void *_arg) 61 { 62 fibril_add_exit_hook(exit_hook); 63 fibril_exit(ETIMEOUT); 64 } 65 66 PCUT_TEST(exit_hook_explicit_exit) 67 { 68 value = 0; 69 fid_t other = fibril_create(fibril_explicit_exit, NULL); 70 fibril_start(other); 71 72 fibril_yield(); 73 74 PCUT_ASSERT_INT_EQUALS(5, value); 75 } 76 77 #ifdef FIBRIL_KILL_HAS_BEEN_IMPLEMENTED 78 static errno_t fibril_to_be_killed(void *_arg) 79 { 80 fibril_add_exit_hook(exit_hook); 81 82 while (true) 83 firbil_yield(); 84 85 assert(0 && "unreachable"); 86 } 87 88 PCUT_TEST(exit_hook_kill) 89 { 90 value = 0; 91 fid_t other = fibril_create(fibril_to_be_killed, NULL); 92 fibril_start(other); 93 94 fibril_yield(); 95 96 fibril_kill(other); // anything like this doesn't exist yet 97 98 PCUT_ASSERT_INT_EQUALS(5, value); 99 } 100 #endif // FIBRIL_KILL_HAS_BEEN_IMPLEMENTED 82 101 83 102 PCUT_EXPORT(fibril_exit_hook); -
uspace/lib/posix/meson.build
r25ee7ec5 raf28af6 61 61 'test/stdlib.c', 62 62 'test/unistd.c', 63 'test/pthread/keys.c', 63 64 ) 64 65 -
uspace/lib/posix/test/main.c
r25ee7ec5 raf28af6 34 34 PCUT_IMPORT(stdlib); 35 35 PCUT_IMPORT(unistd); 36 PCUT_IMPORT(pthread_keys); 36 37 37 38 PCUT_MAIN();
Note:
See TracChangeset
for help on using the changeset viewer.