Commit 93c3faef authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Add refcounting to the thread member of the pipe user.

parent dea29522
...@@ -48,7 +48,7 @@ struct pipe_user ...@@ -48,7 +48,7 @@ struct pipe_user
struct named_pipe *pipe; struct named_pipe *pipe;
struct pipe_user *next; struct pipe_user *next;
struct pipe_user *prev; struct pipe_user *prev;
void *thread; struct thread *thread;
void *func; void *func;
void *overlapped; void *overlapped;
}; };
...@@ -134,6 +134,7 @@ static void notify_waiter( struct pipe_user *user, unsigned int status) ...@@ -134,6 +134,7 @@ static void notify_waiter( struct pipe_user *user, unsigned int status)
thread_queue_apc(user->thread,NULL,user->func, thread_queue_apc(user->thread,NULL,user->func,
APC_ASYNC,1,2,user->overlapped,status); APC_ASYNC,1,2,user->overlapped,status);
} }
if (user->thread) release_object(user->thread);
user->thread = NULL; user->thread = NULL;
user->func = NULL; user->func = NULL;
user->overlapped=NULL; user->overlapped=NULL;
...@@ -172,6 +173,7 @@ static void pipe_user_destroy( struct object *obj) ...@@ -172,6 +173,7 @@ static void pipe_user_destroy( struct object *obj)
if (user->next) user->next->prev = user->prev; if (user->next) user->next->prev = user->prev;
if (user->prev) user->prev->next = user->next; if (user->prev) user->prev->next = user->next;
else user->pipe->users = user->next; else user->pipe->users = user->next;
if (user->thread) release_object(user->thread);
release_object(user->pipe); release_object(user->pipe);
} }
...@@ -361,7 +363,7 @@ DECL_HANDLER(connect_named_pipe) ...@@ -361,7 +363,7 @@ DECL_HANDLER(connect_named_pipe)
else else
{ {
user->state = ps_wait_open; user->state = ps_wait_open;
user->thread = current; user->thread = (struct thread *)grab_object(current);
user->func = req->func; user->func = req->func;
user->overlapped = req->overlapped; user->overlapped = req->overlapped;
...@@ -405,7 +407,7 @@ DECL_HANDLER(wait_named_pipe) ...@@ -405,7 +407,7 @@ DECL_HANDLER(wait_named_pipe)
if( (user = create_pipe_user (pipe, -1)) ) if( (user = create_pipe_user (pipe, -1)) )
{ {
user->state = ps_wait_connect; user->state = ps_wait_connect;
user->thread = current; user->thread = (struct thread *)grab_object(current);
user->func = req->func; user->func = req->func;
user->overlapped = req->overlapped; user->overlapped = req->overlapped;
/* don't release it */ /* don't release it */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment