diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-12 22:30:13 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-12 22:30:13 +0100 |
| commit | 4ac26b61b3116e7a026766673006124aef66fb0b (patch) | |
| tree | 732a1c1bfca388a4443431ae58effe6932ceaa41 /src | |
| parent | cd3a042776769e6080fc5cc3cf8e0184c58a3747 (diff) | |
| download | box64-4ac26b61b3116e7a026766673006124aef66fb0b.tar.gz box64-4ac26b61b3116e7a026766673006124aef66fb0b.zip | |
Fixed pthread_attr_setstacksize to avoid setting too small stack on some platforms. Also added pthread_setschedparam
Diffstat (limited to 'src')
| -rwxr-xr-x | src/libtools/threads.c | 8 | ||||
| -rwxr-xr-x | src/wrapped/wrappedlibpthread_private.h | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libtools/threads.c b/src/libtools/threads.c index 3293edbd..b3e208fd 100755 --- a/src/libtools/threads.c +++ b/src/libtools/threads.c @@ -258,6 +258,14 @@ EXPORT int my_pthread_attr_setstack(x64emu_t* emu, void* attr, void* stackaddr, return pthread_attr_setstacksize(attr, stacksize); } +EXPORT int my_pthread_attr_setstacksize(x64emu_t* emu, void* attr, size_t stacksize) +{ + //aarch64 have an PTHREAD_STACK_MIN of 131072 instead of 16384 on x86_64! + if(stacksize<PTHREAD_STACK_MIN) + stacksize = PTHREAD_STACK_MIN; + return pthread_attr_setstacksize(attr, stacksize); +} + EXPORT int my_pthread_create(x64emu_t *emu, void* t, void* attr, void* start_routine, void* arg) { int stacksize = 2*1024*1024; //default stack size is 2Mo diff --git a/src/wrapped/wrappedlibpthread_private.h b/src/wrapped/wrappedlibpthread_private.h index 23a2a6a5..33c2b5d5 100755 --- a/src/wrapped/wrappedlibpthread_private.h +++ b/src/wrapped/wrappedlibpthread_private.h @@ -38,7 +38,7 @@ GO(pthread_attr_setschedpolicy, iFpi) GO(pthread_attr_setscope, iFpi) GOM(pthread_attr_setstack, iFEppL) GO(pthread_attr_setstackaddr, iFpp) -GO(pthread_attr_setstacksize, iFpL) +GOM(pthread_attr_setstacksize, iFEpL) GO(pthread_barrierattr_destroy, iFp) GO(pthread_barrierattr_getpshared, iFpp) GO(pthread_barrierattr_init, iFp) @@ -162,7 +162,7 @@ GO(pthread_self, LFv) //GO(pthread_setcanceltype, iFip) //GO(pthread_setconcurrency, iFi) //GOM(pthread_setname_np, iFEpp) // not present on the Pandora -//GO(pthread_setschedparam, iFuip) +GO(pthread_setschedparam, iFLip) GO(pthread_setschedprio, iFpi) GO(__pthread_setspecific, iFLp) GO(pthread_setspecific, iFLp) |