summaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 806e210..26deccb 100644
--- a/thread.c
+++ b/thread.c
@@ -143,6 +143,20 @@ sa_thread_t* sa_thread_self(void) {
return t;
}
+int sa_thread_is_self(sa_thread_t *t) {
+ sa_thread_t *c;
+ sa_assert(t);
+
+ if (sa_once(&thread_tls_once, thread_tls_once_func) < 0 || !thread_tls)
+ return 0;
+
+ if ((c = sa_tls_get(thread_tls)))
+ return c == t;
+
+ return 0;
+}
+
+
void* sa_thread_get_data(sa_thread_t *t) {
sa_assert(t);