threads: remove unused code

This commit is contained in:
Kacper Michajłow 2023-10-22 04:46:48 +02:00 committed by Dudemanguy
parent f75fe33da7
commit 751790c2b3
2 changed files with 0 additions and 33 deletions

View File

@ -27,31 +27,6 @@
#include <pthread_np.h>
#endif
int mpthread_mutex_init_recursive(pthread_mutex_t *mutex)
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
int r = pthread_mutex_init(mutex, &attr);
pthread_mutexattr_destroy(&attr);
return r;
}
void mpthread_set_name(const char *name)
{
#if HAVE_GLIBC_THREAD_NAME
if (pthread_setname_np(pthread_self(), name) == ERANGE) {
char tname[16] = {0}; // glibc-checked kernel limit
strncpy(tname, name, sizeof(tname) - 1);
pthread_setname_np(pthread_self(), tname);
}
#elif HAVE_BSD_THREAD_NAME
pthread_set_name_np(pthread_self(), name);
#elif HAVE_OSX_THREAD_NAME
pthread_setname_np(name);
#endif
}
int mp_ptwrap_check(const char *file, int line, int res)
{
if (res && res != ETIMEDOUT) {

View File

@ -1,16 +1,8 @@
#ifndef MP_OSDEP_THREADS_H_
#define MP_OSDEP_THREADS_H_
#include <pthread.h>
#include "config.h"
// Helper to reduce boiler plate.
int mpthread_mutex_init_recursive(pthread_mutex_t *mutex);
// Set thread name (for debuggers).
void mpthread_set_name(const char *name);
enum mp_mutex_type {
MP_MUTEX_NORMAL = 0,
MP_MUTEX_RECURSIVE,