From c1b4872b0910c9aa784d878dca771b21c4690048 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 22 May 2007 22:53:09 +0000 Subject: lots of work git-svn-id: file:///home/lennart/svn/public/libsydney/trunk@30 9ba3c220-e4d3-45a2-8aa3-73fcc9aff6ce --- thread.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'thread.c') 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); -- cgit