mirror of https://github.com/mpv-player/mpv
threads: remove unused code
This commit is contained in:
parent
f75fe33da7
commit
751790c2b3
|
@ -27,31 +27,6 @@
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
#endif
|
#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)
|
int mp_ptwrap_check(const char *file, int line, int res)
|
||||||
{
|
{
|
||||||
if (res && res != ETIMEDOUT) {
|
if (res && res != ETIMEDOUT) {
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
#ifndef MP_OSDEP_THREADS_H_
|
#ifndef MP_OSDEP_THREADS_H_
|
||||||
#define MP_OSDEP_THREADS_H_
|
#define MP_OSDEP_THREADS_H_
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#include "config.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 {
|
enum mp_mutex_type {
|
||||||
MP_MUTEX_NORMAL = 0,
|
MP_MUTEX_NORMAL = 0,
|
||||||
MP_MUTEX_RECURSIVE,
|
MP_MUTEX_RECURSIVE,
|
||||||
|
|
Loading…
Reference in New Issue