@@ -521,8 +521,6 @@ var LibraryPThread = {
521
521
Atomics . store ( HEAPU32 , tis + ( { { { C_STRUCTS . pthread . attr } } } >> 2 ) , threadParams . stackSize ) ;
522
522
Atomics . store ( HEAPU32 , tis + ( { { { C_STRUCTS . pthread . attr } } } + 8 >> 2 ) , stackHigh ) ;
523
523
Atomics . store ( HEAPU32 , tis + ( { { { C_STRUCTS . pthread . attr } } } + 12 >> 2 ) , threadParams . detached ) ;
524
- Atomics . store ( HEAPU32 , tis + ( { { { C_STRUCTS . pthread . attr } } } + 20 >> 2 ) , threadParams . schedPolicy ) ;
525
- Atomics . store ( HEAPU32 , tis + ( { { { C_STRUCTS . pthread . attr } } } + 24 >> 2 ) , threadParams . schedPrio ) ;
526
524
527
525
var global_libc = _emscripten_get_global_libc ( ) ;
528
526
var global_locale = global_libc + { { { C_STRUCTS . libc . global_locale } } } ;
@@ -569,7 +567,7 @@ var LibraryPThread = {
569
567
return navigator [ 'hardwareConcurrency '] ;
570
568
} ,
571
569
572
- { { { USE_LSAN || USE_ASAN ? 'emscripten_builtin_ ' : '' } } } pthread_create__deps : [ '$spawnThread' , 'pthread_getschedparam' , ' pthread_self', 'memalign' , 'emscripten_sync_run_in_main_thread_4' ] ,
570
+ { { { USE_LSAN || USE_ASAN ? 'emscripten_builtin_ ' : '' } } } pthread_create__deps : [ '$spawnThread ', 'pthread_self ', 'memalign ', 'emscripten_sync_run_in_main_thread_4 '] ,
573
571
{ { { USE_LSAN || USE_ASAN ? 'emscripten_builtin_ ' : '' } } } pthread_create : function ( pthread_ptr , attr , start_routine , arg ) {
574
572
if ( typeof SharedArrayBuffer === 'undefined' ) {
575
573
err ( 'Current environment does not support SharedArrayBuffer, pthreads are not available!' ) ;
@@ -696,8 +694,6 @@ var LibraryPThread = {
696
694
var stackBase = 0 ;
697
695
// Default thread attr is PTHREAD_CREATE_JOINABLE, i.e. start as not detached.
698
696
var detached = 0 ;
699
- var schedPolicy = 0 ; /*SCHED_OTHER*/
700
- var schedPrio = 0 ;
701
697
// When musl creates C11 threads it passes __ATTRP_C11_THREAD (-1) which
702
698
// treat as if it was NULL.
703
699
if ( attr && attr != { { { cDefine ( '__ATTRP_C11_THREAD' ) } } } ) {
@@ -713,25 +709,6 @@ var LibraryPThread = {
713
709
stackSize += 81920 /*DEFAULT_STACK_SIZE*/ ;
714
710
stackBase = { { { makeGetValue ( 'attr' , 8 , 'i32' ) } } } ;
715
711
detached = { { { makeGetValue ( 'attr' , 12 /*_a_detach*/ , 'i32' ) } } } !== 0 /*PTHREAD_CREATE_JOINABLE*/ ;
716
- var inheritSched = { { { makeGetValue ( 'attr' , 16 /*_a_sched*/ , 'i32' ) } } } === 0 /*PTHREAD_INHERIT_SCHED*/ ;
717
- if ( inheritSched ) {
718
- var prevSchedPolicy = { { { makeGetValue ( 'attr' , 20 /*_a_policy*/ , 'i32' ) } } } ;
719
- var prevSchedPrio = { { { makeGetValue ( 'attr' , 24 /*_a_prio*/ , 'i32' ) } } } ;
720
- // If we are inheriting the scheduling properties from the parent
721
- // thread, we need to identify the parent thread properly - this
722
- // function call may be getting proxied, in which case _pthread_self()
723
- // will point to the thread performing the proxying, not the thread that
724
- // initiated the call.
725
- var parentThreadPtr = PThread . currentProxiedOperationCallerThread ? PThread . currentProxiedOperationCallerThread : _pthread_self ( ) ;
726
- _pthread_getschedparam ( parentThreadPtr , attr + 20 , attr + 24 ) ;
727
- schedPolicy = { { { makeGetValue ( 'attr' , 20 /*_a_policy*/ , 'i32' ) } } } ;
728
- schedPrio = { { { makeGetValue ( 'attr' , 24 /*_a_prio*/ , 'i32' ) } } } ;
729
- { { { makeSetValue ( 'attr' , 20 /*_a_policy*/ , 'prevSchedPolicy' , 'i32' ) } } } ;
730
- { { { makeSetValue ( 'attr' , 24 /*_a_prio*/ , 'prevSchedPrio' , 'i32' ) } } } ;
731
- } else {
732
- schedPolicy = { { { makeGetValue ( 'attr' , 20 /*_a_policy*/ , 'i32' ) } } } ;
733
- schedPrio = { { { makeGetValue ( 'attr' , 24 /*_a_prio*/ , 'i32' ) } } } ;
734
- }
735
712
} else {
736
713
// According to
737
714
// http://man7.org/linux/man-pages/man3/pthread_create.3.html, default
@@ -779,8 +756,6 @@ var LibraryPThread = {
779
756
stackBase : stackBase ,
780
757
stackSize : stackSize ,
781
758
allocatedOwnStack : allocatedOwnStack ,
782
- schedPolicy : schedPolicy ,
783
- schedPrio : schedPrio ,
784
759
detached : detached ,
785
760
startRoutine : start_routine ,
786
761
pthread_ptr : threadInfoStruct ,
@@ -991,102 +966,6 @@ var LibraryPThread = {
991
966
throw 'unwind' ;
992
967
} ,
993
968
994
- pthread_getschedparam : function ( thread , policy , schedparam ) {
995
- if ( ! policy && ! schedparam ) return ERRNO_CODES . EINVAL ;
996
-
997
- if ( ! thread ) {
998
- err ( 'pthread_getschedparam called with a null thread pointer!' ) ;
999
- return ERRNO_CODES . ESRCH ;
1000
- }
1001
- var self = { { { makeGetValue ( 'thread' , C_STRUCTS . pthread . self , 'i32' ) } } } ;
1002
- if ( self !== thread ) {
1003
- err ( 'pthread_getschedparam attempted on thread ' + thread + ', which does not point to a valid thread , or does not exist anymore ! ') ;
1004
- return ERRNO_CODES . ESRCH ;
1005
- }
1006
-
1007
- var schedPolicy = Atomics . load ( HEAPU32 , ( thread + { { { C_STRUCTS . pthread . attr } } } + 20 ) >> 2 ) ;
1008
- var schedPrio = Atomics . load ( HEAPU32 , ( thread + { { { C_STRUCTS . pthread . attr } } } + 24 ) >> 2 ) ;
1009
-
1010
- if ( policy ) { { { makeSetValue ( 'policy' , 0 , 'schedPolicy' , 'i32' ) } } } ;
1011
- if ( schedparam ) { { { makeSetValue ( 'schedparam ', 0 , 'schedPrio ', 'i32 ') } } } ;
1012
- return 0 ;
1013
- } ,
1014
-
1015
- pthread_setschedparam : function ( thread , policy , schedparam ) {
1016
- if ( ! thread ) {
1017
- err ( 'pthread_setschedparam called with a null thread pointer ! ') ;
1018
- return ERRNO_CODES . ESRCH ;
1019
- }
1020
- var self = { { { makeGetValue ( 'thread' , C_STRUCTS . pthread . self , 'i32' ) } } } ;
1021
- if ( self !== thread ) {
1022
- err ( 'pthread_setschedparam attempted on thread ' + thread + ', which does not point to a valid thread , or does not exist anymore ! ') ;
1023
- return ERRNO_CODES . ESRCH ;
1024
- }
1025
-
1026
- if ( ! schedparam ) return ERRNO_CODES . EINVAL ;
1027
-
1028
- var newSchedPrio = { { { makeGetValue ( 'schedparam' , 0 , 'i32' ) } } } ;
1029
- if ( newSchedPrio < 0 ) return ERRNO_CODES . EINVAL ;
1030
- if ( policy == 1 / * SCHED_FIFO * / || policy == 2 / * SCHED_RR * / ) {
1031
- if ( newSchedPrio > 99 ) return ERRNO_CODES . EINVAL ;
1032
- } else {
1033
- if ( newSchedPrio > 1 ) return ERRNO_CODES . EINVAL ;
1034
- }
1035
-
1036
- Atomics . store ( HEAPU32 , ( thread + { { { C_STRUCTS . pthread . attr } } } + 20 ) >> 2 , policy ) ;
1037
- Atomics . store ( HEAPU32 , ( thread + { { { C_STRUCTS . pthread . attr } } } + 24 ) >> 2 , newSchedPrio ) ;
1038
- return 0 ;
1039
- } ,
1040
-
1041
- // Marked as obsolescent in pthreads specification: http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_getconcurrency.html
1042
- pthread_getconcurrency : function ( ) {
1043
- return 0 ;
1044
- } ,
1045
-
1046
- // Marked as obsolescent in pthreads specification.
1047
- pthread_setconcurrency : function ( new_level ) {
1048
- // no-op
1049
- return 0 ;
1050
- } ,
1051
-
1052
- pthread_mutexattr_getprioceiling : function ( attr , prioceiling ) {
1053
- // Not supported either in Emscripten or musl, return a faked value.
1054
- if ( prioceiling ) { { { makeSetValue ( 'prioceiling' , 0 , 99 , 'i32' ) } } } ;
1055
- return 0 ;
1056
- } ,
1057
-
1058
- pthread_mutexattr_setprioceiling : function ( attr , prioceiling ) {
1059
- // Not supported either in Emscripten or musl, return an error.
1060
- return ERRNO_CODES . EPERM ;
1061
- } ,
1062
-
1063
- pthread_getcpuclockid : function ( thread , clock_id ) {
1064
- return ERRNO_CODES . ENOENT ; // pthread API recommends returning this error when "Per-thread CPU time clocks are not supported by the system."
1065
- } ,
1066
-
1067
- pthread_setschedprio : function ( thread , prio ) {
1068
- if ( ! thread ) {
1069
- err ( 'pthread_setschedprio called with a null thread pointer!' ) ;
1070
- return ERRNO_CODES . ESRCH ;
1071
- }
1072
- var self = { { { makeGetValue ( 'thread' , C_STRUCTS . pthread . self , 'i32' ) } } } ;
1073
- if ( self !== thread ) {
1074
- err ( 'pthread_setschedprio attempted on thread ' + thread + ', which does not point to a valid thread, or does not exist anymore!' ) ;
1075
- return ERRNO_CODES . ESRCH ;
1076
- }
1077
- if ( prio < 0 ) return ERRNO_CODES . EINVAL ;
1078
-
1079
- var schedPolicy = Atomics . load ( HEAPU32 , ( thread + { { { C_STRUCTS . pthread . attr } } } + 20 ) >> 2 ) ;
1080
- if ( schedPolicy == 1 /*SCHED_FIFO*/ || schedPolicy == 2 /*SCHED_RR*/ ) {
1081
- if ( prio > 99 ) return ERRNO_CODES . EINVAL ;
1082
- } else {
1083
- if ( prio > 1 ) return ERRNO_CODES . EINVAL ;
1084
- }
1085
-
1086
- Atomics . store ( HEAPU32 , ( thread + { { { C_STRUCTS . pthread . attr } } } + 24 ) >> 2 , prio ) ;
1087
- return 0 ;
1088
- } ,
1089
-
1090
969
pthread_cleanup_push__sig : 'vii ',
1091
970
pthread_cleanup_push : function ( routine , arg ) {
1092
971
PThread . threadExitHandlers . push ( function ( ) { { { { makeDynCall ( 'vi' , 'routine' ) } } } ( arg ) } ) ;
@@ -1097,11 +976,6 @@ var LibraryPThread = {
1097
976
if ( execute ) routine ( ) ;
1098
977
} ,
1099
978
1100
- pthread_atfork : function ( prepare , parent , child ) {
1101
- err ( 'fork() is not supported: pthread_atfork is a no-op.' ) ;
1102
- return 0 ;
1103
- } ,
1104
-
1105
979
// Returns 0 on success, or one of the values -ETIMEDOUT, -EWOULDBLOCK or -EINVAL on error.
1106
980
emscripten_futex_wait__deps : [ 'emscripten_main_thread_process_queued_calls' ] ,
1107
981
emscripten_futex_wait : function ( addr , val , timeout ) {
0 commit comments