Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
remove uv_thread_self
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Zinkovsky committed Jan 14, 2012
1 parent 94a5c7b commit 2651273
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 28 deletions.
1 change: 0 additions & 1 deletion include/uv.h
Expand Up @@ -1349,7 +1349,6 @@ UV_EXTERN void uv_once(uv_once_t* guard, void (*callback)(void));
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 {
Expand Down
4 changes: 0 additions & 4 deletions src/unix/thread.c
Expand Up @@ -47,10 +47,6 @@ 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))
Expand Down
5 changes: 0 additions & 5 deletions src/win/thread.c
Expand Up @@ -113,11 +113,6 @@ int uv_thread_join(uv_thread_t *tid) {
}


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


int uv_mutex_init(uv_mutex_t* mutex) {
InitializeCriticalSection(mutex);
return 0;
Expand Down
2 changes: 0 additions & 2 deletions test/test-list.h
Expand Up @@ -125,7 +125,6 @@ TEST_DECLARE (threadpool_multiple_event_loops)
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)
Expand Down Expand Up @@ -294,7 +293,6 @@ 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)
Expand Down
16 changes: 0 additions & 16 deletions test/test-thread.c
Expand Up @@ -59,8 +59,6 @@ static volatile int thread_called;
static void getaddrinfo_do(struct getaddrinfo_req* req) {
int r;

ASSERT(req->thread_id == uv_thread_self());

r = uv_getaddrinfo(req->loop,
&req->handle,
getaddrinfo_cb,
Expand Down Expand Up @@ -89,8 +87,6 @@ static void getaddrinfo_cb(uv_getaddrinfo_t* handle,
static void fs_do(struct fs_req* req) {
int r;

ASSERT(req->thread_id == uv_thread_self());

r = uv_fs_stat(req->loop, &req->handle, ".", fs_cb);
ASSERT(r == 0);
}
Expand All @@ -107,27 +103,22 @@ static void fs_cb(uv_fs_t* handle) {
static void do_work(void* arg) {
struct getaddrinfo_req getaddrinfo_reqs[16];
struct fs_req fs_reqs[16];
uv_thread_t self;
uv_loop_t* loop;
size_t i;
int r;

self = uv_thread_self();

loop = uv_loop_new();
ASSERT(loop != NULL);

for (i = 0; i < ARRAY_SIZE(getaddrinfo_reqs); i++) {
struct getaddrinfo_req* req = getaddrinfo_reqs + i;
req->thread_id = self;
req->counter = 16;
req->loop = loop;
getaddrinfo_do(req);
}

for (i = 0; i < ARRAY_SIZE(fs_reqs); i++) {
struct fs_req* req = fs_reqs + i;
req->thread_id = self;
req->counter = 16;
req->loop = loop;
fs_do(req);
Expand Down Expand Up @@ -162,13 +153,6 @@ TEST_IMPL(thread_create) {
}


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


/* Hilariously bad test name. Run a lot of tasks in the thread pool and verify
* that each "finished" callback is run in its originating thread.
*/
Expand Down

0 comments on commit 2651273

Please sign in to comment.