aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/threads.cpp25
-rw-r--r--common/threads.h26
2 files changed, 8 insertions, 43 deletions
diff --git a/common/threads.cpp b/common/threads.cpp
index 48f62274..7d44c012 100644
--- a/common/threads.cpp
+++ b/common/threads.cpp
@@ -60,7 +60,7 @@
static ThrSafeMap<DWORD,HANDLE> ThrdIdHandle{};
-void althrd_setname(althrd_t thr, const char *name)
+void althrd_setname(const char *name)
{
#if defined(_MSC_VER)
#define MS_VC_EXCEPTION 0x406D1388
@@ -74,7 +74,7 @@ void althrd_setname(althrd_t thr, const char *name)
#pragma pack(pop)
info.dwType = 0x1000;
info.szName = name;
- info.dwThreadID = thr;
+ info.dwThreadID = -1;
info.dwFlags = 0;
__try {
@@ -84,7 +84,6 @@ void althrd_setname(althrd_t thr, const char *name)
}
#undef MS_VC_EXCEPTION
#else
- (void)thr;
(void)name;
#endif
}
@@ -207,11 +206,6 @@ int alsem_trywait(alsem_t *sem)
return althrd_error;
}
-
-void althrd_deinit(void)
-{
-}
-
#else
#include <sys/time.h>
@@ -222,21 +216,19 @@ void althrd_deinit(void)
#endif
-void althrd_setname(althrd_t thr, const char *name)
+void althrd_setname(const char *name)
{
#if defined(HAVE_PTHREAD_SETNAME_NP)
#if defined(PTHREAD_SETNAME_NP_ONE_PARAM)
- if(althrd_equal(thr, althrd_current()))
- pthread_setname_np(name);
+ pthread_setname_np(name);
#elif defined(PTHREAD_SETNAME_NP_THREE_PARAMS)
- pthread_setname_np(thr, "%s", (void*)name);
+ pthread_setname_np(pthread_self(), "%s", (void*)name);
#else
- pthread_setname_np(thr, name);
+ pthread_setname_np(pthread_self(), name);
#endif
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
- pthread_set_name_np(thr, name);
+ pthread_set_name_np(pthread_self(), name);
#else
- (void)thr;
(void)name;
#endif
}
@@ -436,7 +428,4 @@ int alsem_trywait(alsem_t *sem)
#endif /* __APPLE__ */
-void althrd_deinit(void)
-{ }
-
#endif
diff --git a/common/threads.h b/common/threads.h
index 9abb22f2..0b53c38f 100644
--- a/common/threads.h
+++ b/common/threads.h
@@ -42,18 +42,6 @@ typedef CRITICAL_SECTION almtx_t;
typedef HANDLE alsem_t;
-void althrd_deinit(void);
-
-inline althrd_t althrd_current(void)
-{
- return GetCurrentThreadId();
-}
-
-inline int althrd_equal(althrd_t thr0, althrd_t thr1)
-{
- return thr0 == thr1;
-}
-
inline void althrd_yield(void)
{
SwitchToThread();
@@ -94,18 +82,6 @@ typedef sem_t alsem_t;
#endif /* __APPLE__ */
-void althrd_deinit(void);
-
-inline althrd_t althrd_current(void)
-{
- return pthread_self();
-}
-
-inline int althrd_equal(althrd_t thr0, althrd_t thr1)
-{
- return pthread_equal(thr0, thr1);
-}
-
inline void althrd_yield(void)
{
sched_yield();
@@ -132,7 +108,7 @@ inline int almtx_unlock(almtx_t *mtx)
int althrd_create(althrd_t *thr, althrd_start_t func, void *arg);
int althrd_detach(althrd_t thr);
int althrd_join(althrd_t thr, int *res);
-void althrd_setname(althrd_t thr, const char *name);
+void althrd_setname(const char *name);
int almtx_init(almtx_t *mtx, int type);
void almtx_destroy(almtx_t *mtx);