Skip to content

Commit

Permalink
Auto merge of #2764 - vityafx:add-more-posix-functions-for-emscripten…
Browse files Browse the repository at this point in the history
…, r=Amanieu

Add pthread_[s,g]etschedparam to emscripten.

Closes #2754

The functions are available in emscripten when built with the posix threads support.
  • Loading branch information
bors committed Apr 22, 2022
2 parents 40d529f + e4f4684 commit 73ad8ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Expand Up @@ -2448,6 +2448,7 @@ fn test_emscripten(target: &str) {

let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None); // FIXME: ??
cfg.flag("-pthread"); // Enable POSIX threads support.

headers! { cfg:
"aio.h",
Expand Down
10 changes: 10 additions & 0 deletions src/unix/linux_like/emscripten/mod.rs
Expand Up @@ -1879,6 +1879,16 @@ extern "C" {
f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
value: *mut ::c_void,
) -> ::c_int;
pub fn pthread_setschedparam(
native: ::pthread_t,
policy: ::c_int,
param: *const ::sched_param,
) -> ::c_int;
pub fn pthread_getschedparam(
native: ::pthread_t,
policy: *mut ::c_int,
param: *mut ::sched_param,
) -> ::c_int;
}

cfg_if! {
Expand Down

0 comments on commit 73ad8ae

Please sign in to comment.