|
6 | 6 | // (0.17) the system is named, this program names itself with the moment it |
7 | 7 | // started, and a rename that does not replace refuses a name that is taken; |
8 | 8 | // (0.17.1) a joined command line is refused where programs receive vectors; |
9 | | -// (0.18) a file is mapped, the region holds its bytes and zero after its end. |
| 9 | +// (0.18) a file is mapped, the region holds its bytes and zero after its end; |
| 10 | +// (0.19) the cores are no more than the processors, and a started context |
| 11 | +// lowers its claim on the processors where the implementation claims it. |
10 | 12 | // The terminal is not observed here, |
11 | 13 | // because a test run has none; the implementations observe it on a terminal |
12 | 14 | // they make. |
@@ -34,6 +36,9 @@ long (*volatile g_recurse)(long) = recurse; |
34 | 36 | long recurse(long n) { volatile char pad[1000]; pad[0] = static_cast<char>(n); return n ? g_recurse(n - 1) + pad[0] : 0; } |
35 | 37 |
|
36 | 38 | struct probe { kal_uintptr told; volatile int done; }; |
| 39 | + |
| 40 | +int g_claim = -1; |
| 41 | +void lowers(void*) { g_claim = kal_task_set_priority(KAL_TASK_PRIORITY_BACKGROUND); } |
37 | 42 | void room(void* p) { |
38 | 43 | auto* q = static_cast<probe*>(p); |
39 | 44 | void* base = nullptr; kal_uintptr size = 0; |
@@ -121,6 +126,18 @@ int main() { |
121 | 126 | kal_fs_remove(root, "okt.m", 5); |
122 | 127 | } |
123 | 128 |
|
| 129 | + { |
| 130 | + const kal_uintptr cores = kal_task_cores(), processors = kal_task_parallelism(); |
| 131 | + check(processors == 0 || cores <= processors, "the cores are no more than the processors"); |
| 132 | + kal_task t{}; |
| 133 | + if (kal_task_start(lowers, nullptr, &t) == kal_ok) { |
| 134 | + kal_task_join(t); |
| 135 | + const bool claims = (kal_task_props() & KAL_TASK_PROP_PRIORITY) != 0; |
| 136 | + check(claims ? g_claim == kal_ok : g_claim == kal_err_not_supported, |
| 137 | + "a started context lowers its claim to background, or is told the implementation has none"); |
| 138 | + } |
| 139 | + } |
| 140 | + |
124 | 141 | if (failures == 0) kal_stream_write(kal_stdout(), "openkal: held\n", 14); |
125 | 142 | return failures == 0 ? 0 : 1; |
126 | 143 | } |
0 commit comments