From: Rémi Bernon rbernon@codeweavers.com
--- server/thread.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/server/thread.c b/server/thread.c index 6f99b8c0415..a418100d9e0 100644 --- a/server/thread.c +++ b/server/thread.c @@ -125,6 +125,7 @@ static const struct object_ops thread_apc_ops = struct context { struct object obj; /* object header */ + struct event *sync; /* event object as sync */ unsigned int status; /* status of the context */ struct context_data regs[2];/* context data */ }; @@ -136,16 +137,7 @@ static const unsigned int system_flags = SERVER_CTX_DEBUG_REGISTERS;
static void dump_context( struct object *obj, int verbose ); static struct sync *context_get_sync( struct object *obj ); -static int context_signaled( struct object *obj, struct wait_queue_entry *entry ); - -static const struct sync_ops context_sync_ops = -{ - add_queue, /* add_queue */ - remove_queue, /* remove_queue */ - context_signaled, /* signaled */ - no_satisfied, /* satisfied */ - no_signal, /* signal */ -}; +static void context_destroy( struct object *obj );
static const struct object_ops context_ops = { @@ -164,7 +156,7 @@ static const struct object_ops context_ops = no_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ no_close_handle, /* close_handle */ - no_destroy /* destroy */ + context_destroy /* destroy */ };
@@ -460,22 +452,21 @@ static struct sync *context_get_sync( struct object *obj ) { struct context *context = (struct context *)obj; assert( obj->ops == &context_ops ); - return &context->obj.sync; + return get_event_sync( context->sync ); }
- -static int context_signaled( struct object *obj, struct wait_queue_entry *entry ) +static void context_destroy( struct object *obj ) { struct context *context = (struct context *)obj; - return context->status != STATUS_PENDING; + assert( obj->ops == &context_ops ); + release_object( context->sync ); }
- static struct context *create_thread_context( struct thread *thread ) { struct context *context; if (!(context = alloc_object( &context_ops ))) return NULL; - context->obj.sync.ops = &context_sync_ops; + context->sync = create_event_sync( 1, 0 ); context->status = STATUS_PENDING; memset( &context->regs, 0, sizeof(context->regs) ); context->regs[CTX_NATIVE].machine = native_machine; @@ -594,7 +585,7 @@ static void cleanup_thread( struct thread *thread ) if (thread->context) { thread->context->status = STATUS_ACCESS_DENIED; - wake_up( &thread->context->obj, 0 ); + set_event( thread->context->sync ); release_object( thread->context ); thread->context = NULL; } @@ -1938,7 +1929,7 @@ DECL_HANDLER(select) } ctx->status = STATUS_SUCCESS; current->suspend_cookie = req->cookie; - wake_up( &ctx->obj, 0 ); + set_event( ctx->sync ); }
if (!req->cookie) goto invalid_param;