Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,10 @@ jobs:
n=$("$NM" --defined-only $objs 2>/dev/null \
| awk '$2=="T"||$2=="W"{print $3}' | sed 's/^_//' \
| grep -c '^kal_task' || true)
test "$n" -eq 10 || { echo "::error::expected 10 kal_task symbols with the switch, found $n"; exit 1; }
echo " ok ten task symbols with the switch"
# As many as the specification's surface names: the interface is provided whole.
want=$(grep -c '^kal_task' .spec/SURFACE.txt)
test "$n" -eq "$want" || { echo "::error::expected $want kal_task symbols with the switch (SURFACE.txt), found $n"; exit 1; }
echo " ok every task symbol of SURFACE.txt with the switch ($n)"
( cd "$work" && timeout 300 mcpp run --target wasm32-emscripten ) \
|| { echo "::error::the task program did not exit 0 under node"; exit 1; }
echo " ok a task starts, runs and joins under node, and both contexts are told their own stack"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ So the interface is carried by a feature:

```toml
[dependencies]
openkal-emscripten = { version = "0.7.0", features = ["threads"] }
openkal-emscripten = { version = "0.8.0", features = ["threads"] }
```

Without it, `src/threads/task.cpp` compiles to nothing, the ten `kal_task_*`
Expand Down Expand Up @@ -172,10 +172,10 @@ implementation in its source:

```toml
[dependencies]
openkal = "0.18.0"
openkal = "0.19.0"

[target.'cfg(os = "emscripten")'.dependencies]
openkal-emscripten = "0.7.0"
openkal-emscripten = "0.8.0"
```

## Licence
Expand Down
4 changes: 2 additions & 2 deletions mcpp.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
namespace = "mcpplibs"
name = "openkal-emscripten"
version = "0.7.0"
version = "0.8.0"
description = "An implementation of openkal for Emscripten, written ABOVE a C library rather than beneath one, because on this platform there is no kernel to issue calls to."
license = "Apache-2.0"

Expand All @@ -18,7 +18,7 @@ authors = ["mcpplibs"]
repo = "https://github.com/mcpplibs/openkal-emscripten"

[dependencies]
openkal = "0.18.0"
openkal = "0.19.0"

[build]
# THE DIALECT FLAGS ARE THE SAME AS EVERY OTHER IMPLEMENTATION'S AND THE REASON
Expand Down
12 changes: 12 additions & 0 deletions src/threads/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ kal_uintptr kal_task_parallelism(void) {
return n > 0 ? static_cast<kal_uintptr>(n) : 1u;
}

// THE PLATFORM STATES NO CORES: a browser reports the logical processors
// (`navigator.hardwareConcurrency') and nothing beneath them. Zero is "cannot
// say", and a caller sizes by kal_task_parallelism, as it would have.
kal_uintptr kal_task_cores(void) { return 0; }

// A WORKER'S CLAIM ON THE PROCESSORS IS THE BROWSER'S, and nothing a page runs
// can lower it. KAL_TASK_PROP_PRIORITY is withheld below for that reason.
int kal_task_set_priority(kal_uintptr priority) {
if (priority > KAL_TASK_PRIORITY_BACKGROUND) return kal_err_invalid;
return kal_err_not_supported;
}


// Yielding is a real operation here: a worker gives way to the host's
// scheduler.
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ kal_u64 kal_version(void) { return KAL_VERSION; }
// known at link time to run time.
// TASK only in a `-pthread` link, and the word follows the link rather
// than being written down. Without it `src/threads/task.cpp` is
// not compiled at all, so the eight `kal_task_*` symbols are
// not compiled at all, so the `kal_task_*` symbols are
// absent and the same mechanism reports them -- an interface is
// provided in whole or not at all, and a `kal_task_start` that
// could not start anything is the shape clause 6.2 forbids.
Expand Down
Loading