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/libtools/threads.c | |
| 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/libtools/threads.c')
| -rwxr-xr-x | src/libtools/threads.c | 8 |
1 files changed, 8 insertions, 0 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 |