[GH-ISSUE #952] Call of overloaded ‘pthread_mutex_timedlock(pthread_mutex_t*, timespec*)’ is ambiguous #287

Closed
opened 2026-02-27 21:05:31 +03:00 by kerem · 0 comments
Owner

Originally created by @ciceroadf on GitHub (Sep 17, 2024).
Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/952

I was having trouble building from source in Linux Ubuntu 20.04 with this function:

/home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp: In function ‘int Libraries::Kernel::scePthreadMutexTimedlock(PthreadMutexInternal**, u64)’:
/home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp:915:41: error: call of overloaded ‘pthread_mutex_timedlock(pthread_mutex_t*, timespec*)’ is ambiguous
  915 |     int result = pthread_mutex_timedlock(&((*mutex)->pth_mutex), &time);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp:876:12: note: candidate: ‘int Libraries::Kernel::pthread_mutex_timedlock(pthread_mutex_t*, const timespec*)876 | static int pthread_mutex_timedlock(pthread_mutex_t* mutex, const struct timespec* abstime) {
      |            ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr.h:148,
                 from /usr/include/c++/13/bits/std_mutex.h:41,
                 from /usr/include/c++/13/mutex:45,
                 from /home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp:4:
/usr/include/pthread.h:743:12: note: candidate: ‘int pthread_mutex_timedlock(pthread_mutex_t*, const timespec*)743 | extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex,
      |            ^~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/shadps4.dir/build.make:832: CMakeFiles/shadps4.dir/src/core/libraries/kernel/thread_management.cpp.o] Erro 1
make[2]: ** Esperando que outros processos terminem.
make[1]: *** [CMakeFiles/Makefile2:558: CMakeFiles/shadps4.dir/all] Erro 2
make: *** [Makefile:156: all] Erro 2

Solved changing line 915 at src/core/libraries/kernel/thread_management.cpp to the following:

int result = Libraries::Kernel::pthread_mutex_timedlock(&(*mutex)->pth_mutex, &time);
Originally created by @ciceroadf on GitHub (Sep 17, 2024). Original GitHub issue: https://github.com/shadps4-emu/shadPS4/issues/952 I was having trouble building from source in Linux Ubuntu 20.04 with this function: ```bash /home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp: In function ‘int Libraries::Kernel::scePthreadMutexTimedlock(PthreadMutexInternal**, u64)’: /home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp:915:41: error: call of overloaded ‘pthread_mutex_timedlock(pthread_mutex_t*, timespec*)’ is ambiguous 915 | int result = pthread_mutex_timedlock(&((*mutex)->pth_mutex), &time); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp:876:12: note: candidate: ‘int Libraries::Kernel::pthread_mutex_timedlock(pthread_mutex_t*, const timespec*)’ 876 | static int pthread_mutex_timedlock(pthread_mutex_t* mutex, const struct timespec* abstime) { | ^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr-default.h:35, from /usr/include/x86_64-linux-gnu/c++/13/bits/gthr.h:148, from /usr/include/c++/13/bits/std_mutex.h:41, from /usr/include/c++/13/mutex:45, from /home/cicero/Projetos Pessoais/Estudo C/c-practice/shadPS4/src/core/libraries/kernel/thread_management.cpp:4: /usr/include/pthread.h:743:12: note: candidate: ‘int pthread_mutex_timedlock(pthread_mutex_t*, const timespec*)’ 743 | extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, | ^~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/shadps4.dir/build.make:832: CMakeFiles/shadps4.dir/src/core/libraries/kernel/thread_management.cpp.o] Erro 1 make[2]: ** Esperando que outros processos terminem. make[1]: *** [CMakeFiles/Makefile2:558: CMakeFiles/shadps4.dir/all] Erro 2 make: *** [Makefile:156: all] Erro 2 ``` Solved changing line 915 at src/core/libraries/kernel/thread_management.cpp to the following: ```bash int result = Libraries::Kernel::pthread_mutex_timedlock(&(*mutex)->pth_mutex, &time); ```
kerem closed this issue 2026-02-27 21:05:32 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#287
No description provided.