Commit d6d994f1 authored by Alexandre Julliard's avatar Alexandre Julliard

Made event manipulation routines public.

parent 22b861c1
...@@ -59,45 +59,29 @@ static struct event *create_event( const char *name, size_t len, ...@@ -59,45 +59,29 @@ static struct event *create_event( const char *name, size_t len,
return event; return event;
} }
static int pulse_event( int handle ) struct event *get_event_obj( struct process *process, int handle, unsigned int access )
{ {
struct event *event; return (struct event *)get_handle_obj( current->process, handle, access, &event_ops );
}
if (!(event = (struct event *)get_handle_obj( current->process, handle, void pulse_event( struct event *event )
EVENT_MODIFY_STATE, &event_ops ))) {
return 0;
event->signaled = 1; event->signaled = 1;
/* wake up all waiters if manual reset, a single one otherwise */ /* wake up all waiters if manual reset, a single one otherwise */
wake_up( &event->obj, !event->manual_reset ); wake_up( &event->obj, !event->manual_reset );
event->signaled = 0; event->signaled = 0;
release_object( event );
return 1;
} }
static int set_event( int handle ) void set_event( struct event *event )
{ {
struct event *event;
if (!(event = (struct event *)get_handle_obj( current->process, handle,
EVENT_MODIFY_STATE, &event_ops )))
return 0;
event->signaled = 1; event->signaled = 1;
/* wake up all waiters if manual reset, a single one otherwise */ /* wake up all waiters if manual reset, a single one otherwise */
wake_up( &event->obj, !event->manual_reset ); wake_up( &event->obj, !event->manual_reset );
release_object( event );
return 1;
} }
static int reset_event( int handle ) void reset_event( struct event *event )
{ {
struct event *event;
if (!(event = (struct event *)get_handle_obj( current->process, handle,
EVENT_MODIFY_STATE, &event_ops )))
return 0;
event->signaled = 0; event->signaled = 0;
release_object( event );
return 1;
} }
static void event_dump( struct object *obj, int verbose ) static void event_dump( struct object *obj, int verbose )
...@@ -149,18 +133,22 @@ DECL_HANDLER(open_event) ...@@ -149,18 +133,22 @@ DECL_HANDLER(open_event)
/* do an event operation */ /* do an event operation */
DECL_HANDLER(event_op) DECL_HANDLER(event_op)
{ {
struct event *event;
if (!(event = get_event_obj( current->process, req->handle, EVENT_MODIFY_STATE ))) return;
switch(req->op) switch(req->op)
{ {
case PULSE_EVENT: case PULSE_EVENT:
pulse_event( req->handle ); pulse_event( event );
break; break;
case SET_EVENT: case SET_EVENT:
set_event( req->handle ); set_event( event );
break; break;
case RESET_EVENT: case RESET_EVENT:
reset_event( req->handle ); reset_event( event );
break; break;
default: default:
fatal_protocol_error( current, "event_op: invalid operation %d\n", req->op ); fatal_protocol_error( current, "event_op: invalid operation %d\n", req->op );
} }
release_object( event );
} }
...@@ -126,6 +126,15 @@ extern void remove_client( struct client *client, int exit_code ); ...@@ -126,6 +126,15 @@ extern void remove_client( struct client *client, int exit_code );
extern void client_pass_fd( struct client *client, int pass_fd ); extern void client_pass_fd( struct client *client, int pass_fd );
extern void client_reply( struct client *client, unsigned int res ); extern void client_reply( struct client *client, unsigned int res );
/* event functions */
struct event;
extern struct event *get_event_obj( struct process *process, int handle, unsigned int access );
extern void pulse_event( struct event *event );
extern void set_event( struct event *event );
extern void reset_event( struct event *event );
/* mutex functions */ /* mutex functions */
extern void abandon_mutexes( struct thread *thread ); extern void abandon_mutexes( struct thread *thread );
......
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