Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

add uv_thread_self

  • Loading branch information...
ry committed Dec 20, 2011
1 parent 3cbe7c3 commit a993329c0299dd3af17518d05f36cb0efda639e4
Showing with 14 additions and 0 deletions.
  1. +1 −0 include/uv.h
  2. +4 −0 src/unix/thread.c
  3. +2 −0 test/test-list.h
  4. +7 −0 test/test-thread.c
@@ -1342,6 +1342,7 @@ UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock);
UV_EXTERN int uv_thread_create(uv_thread_t *tid,
void (*entry)(void *arg), void *arg);
UV_EXTERN int uv_thread_join(uv_thread_t *tid);
UV_EXTERN uv_thread_t uv_thread_self(void);

/* the presence of these unions force similar struct layout */
union uv_any_handle {
@@ -47,6 +47,10 @@ int uv_thread_join(uv_thread_t *tid) {
return 0;
}

uv_thread_t uv_thread_self(void) {
return pthread_self();
}


int uv_mutex_init(uv_mutex_t* mutex) {
if (pthread_mutex_init(mutex, NULL))
@@ -122,6 +122,7 @@ TEST_DECLARE (threadpool_queue_work_simple)
TEST_DECLARE (thread_mutex)
TEST_DECLARE (thread_rwlock)
TEST_DECLARE (thread_create)
TEST_DECLARE (thread_self)
TEST_DECLARE (strlcpy)
TEST_DECLARE (strlcat)
TEST_DECLARE (counters_init)
@@ -287,6 +288,7 @@ TASK_LIST_START
TEST_ENTRY (thread_mutex)
TEST_ENTRY (thread_rwlock)
TEST_ENTRY (thread_create)
TEST_ENTRY (thread_self)
TEST_ENTRY (strlcpy)
TEST_ENTRY (strlcat)
TEST_ENTRY (counters_init)
@@ -49,3 +49,10 @@ TEST_IMPL(thread_create) {

return 0;
}


TEST_IMPL(thread_self) {
uv_thread_t tid;
tid = uv_thread_self();
return 0;
}

0 comments on commit a993329

Please sign in to comment.
You can’t perform that action at this time.