From: Rémi Bernon rbernon@codeweavers.com
--- server/async.c | 8 ++++---- server/completion.c | 12 ++++++------ server/console.c | 26 +++++++++++++------------- server/debugger.c | 8 ++++---- server/device.c | 4 ++-- server/event.c | 18 ++++++++---------- server/fd.c | 8 ++++---- server/mutex.c | 12 ++++++------ server/object.c | 6 +++--- server/object.h | 16 ++++++++-------- server/process.c | 12 ++++++------ server/queue.c | 23 ++++++++++------------- server/semaphore.c | 12 ++++++------ server/thread.c | 31 +++++++++++++++---------------- server/thread.h | 4 ++-- server/timer.c | 8 ++++---- 16 files changed, 101 insertions(+), 107 deletions(-)
diff --git a/server/async.c b/server/async.c index 399fb530789..98a9f2fcf7e 100644 --- a/server/async.c +++ b/server/async.c @@ -68,8 +68,8 @@ struct async
static void async_dump( struct object *obj, int verbose ); static struct sync *async_get_sync( struct object *obj ); -static int async_signaled( struct object *obj, struct wait_queue_entry *entry ); -static void async_satisfied( struct object * obj, struct wait_queue_entry *entry ); +static int async_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void async_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void async_destroy( struct object *obj );
static const struct sync_ops async_sync_ops = @@ -122,14 +122,14 @@ static struct sync *async_get_sync( struct object *obj ) return async->sync; }
-static int async_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int async_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct async *async = (struct async *)obj; assert( obj->ops == &async_ops ); return async->signaled; }
-static void async_satisfied( struct object *obj, struct wait_queue_entry *entry ) +static void async_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct async *async = (struct async *)obj; assert( obj->ops == &async_ops ); diff --git a/server/completion.c b/server/completion.c index cf3588c4267..c5e0ebd2d6b 100644 --- a/server/completion.c +++ b/server/completion.c @@ -83,8 +83,8 @@ struct completion
static void completion_wait_dump( struct object*, int ); static struct sync *completion_wait_get_sync( struct object * ); -static int completion_wait_signaled( struct object *obj, struct wait_queue_entry *entry ); -static void completion_wait_satisfied( struct object *obj, struct wait_queue_entry *entry ); +static int completion_wait_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void completion_wait_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void completion_wait_destroy( struct object * );
static const struct sync_ops completion_wait_sync_ops = @@ -140,7 +140,7 @@ static struct sync *completion_wait_get_sync( struct object *obj ) return wait->sync; }
-static int completion_wait_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int completion_wait_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct completion_wait *wait = (struct completion_wait *)obj;
@@ -149,7 +149,7 @@ static int completion_wait_signaled( struct object *obj, struct wait_queue_entry return wait->completion->depth; }
-static void completion_wait_satisfied( struct object *obj, struct wait_queue_entry *entry ) +static void completion_wait_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct completion_wait *wait = (struct completion_wait *)obj; struct list *msg_entry; @@ -172,7 +172,7 @@ static void completion_wait_satisfied( struct object *obj, struct wait_queue_ent
static void completion_dump( struct object*, int ); static struct sync *completion_get_sync( struct object * ); -static int completion_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int completion_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static int completion_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void completion_destroy( struct object * );
@@ -235,7 +235,7 @@ static struct sync *completion_get_sync( struct object *obj ) return completion->sync; }
-static int completion_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int completion_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct completion *completion = (struct completion *)obj;
diff --git a/server/console.c b/server/console.c index 9b0e7e2e63a..463a94d3349 100644 --- a/server/console.c +++ b/server/console.c @@ -69,14 +69,14 @@ struct console
static void console_dump( struct object *obj, int verbose ); static void console_destroy( struct object *obj ); -static int console_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int console_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static struct fd *console_get_fd( struct object *obj ); static struct sync *console_get_sync( struct object *obj ); static struct object *console_lookup_name( struct object *obj, struct unicode_str *name, unsigned int attr, struct object *root ); static struct object *console_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); -static int console_add_queue( struct object *obj, struct wait_queue_entry *entry ); +static int console_add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry );
static const struct sync_ops console_sync_ops = { @@ -156,7 +156,7 @@ struct console_server
static void console_server_dump( struct object *obj, int verbose ); static void console_server_destroy( struct object *obj ); -static int console_server_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int console_server_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static struct fd *console_server_get_fd( struct object *obj ); static struct sync *console_server_get_sync( struct object *obj ); static struct object *console_server_lookup_name( struct object *obj, struct unicode_str *name, @@ -236,7 +236,7 @@ struct screen_buffer
static void screen_buffer_dump( struct object *obj, int verbose ); static void screen_buffer_destroy( struct object *obj ); -static int screen_buffer_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int screen_buffer_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static struct fd *screen_buffer_get_fd( struct object *obj ); static struct sync *screen_buffer_get_sync( struct object *obj ); static struct object *screen_buffer_open_file( struct object *obj, unsigned int access, @@ -328,7 +328,7 @@ struct console_input };
static void console_input_dump( struct object *obj, int verbose ); -static int console_input_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int console_input_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static struct object *console_input_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); static struct fd *console_input_get_fd( struct object *obj ); @@ -396,7 +396,7 @@ struct console_output };
static void console_output_dump( struct object *obj, int verbose ); -static int console_output_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int console_output_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static struct fd *console_output_get_fd( struct object *obj ); static struct sync *console_output_get_sync( struct object *obj ); static struct object *console_output_open_file( struct object *obj, unsigned int access, @@ -509,7 +509,7 @@ static const struct fd_ops console_connection_fd_ops = static int queue_host_ioctl( struct console_server *server, unsigned int code, unsigned int output, struct async *async, struct async_queue *queue );
-static int console_add_queue( struct object *obj, struct wait_queue_entry *entry ) +static int console_add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct console *console = (struct console*)obj; assert( obj->ops == &console_ops ); @@ -520,10 +520,10 @@ static int console_add_queue( struct object *obj, struct wait_queue_entry *entry if (console->server->term_fd == -1) queue_host_ioctl( console->server, IOCTL_CONDRV_PEEK, 0, NULL, NULL ); } - return add_queue( &console->obj, entry ); + return add_queue( sync, &console->obj, entry ); }
-static int console_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int console_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct console *console = (struct console*)obj; return console->signaled; @@ -900,7 +900,7 @@ static void screen_buffer_destroy( struct object *obj ) release_sync( screen_buffer->sync ); }
-static int screen_buffer_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int screen_buffer_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct screen_buffer *screen_buffer = (struct screen_buffer *)obj; assert( obj->ops == &screen_buffer_ops ); @@ -984,7 +984,7 @@ static struct object *console_server_lookup_name( struct object *obj, struct uni return NULL; }
-static int console_server_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int console_server_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct console_server *server = (struct console_server*)obj; assert( obj->ops == &console_server_ops ); @@ -1485,7 +1485,7 @@ static void console_input_dump( struct object *obj, int verbose ) fputs( "console Input device\n", stderr ); }
-static int console_input_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int console_input_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct console_input *console_input = (struct console_input *)obj; assert( obj->ops == &console_input_ops ); @@ -1564,7 +1564,7 @@ static void console_output_dump( struct object *obj, int verbose ) fputs( "console Output device\n", stderr ); }
-static int console_output_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int console_output_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct console_output *console_output = (struct console_output *)obj; assert( obj->ops == &console_output_ops ); diff --git a/server/debugger.c b/server/debugger.c index 576a751823d..74631630565 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -78,7 +78,7 @@ struct debug_obj
static void debug_event_dump( struct object *obj, int verbose ); static struct sync *debug_event_get_sync( struct object *obj ); -static int debug_event_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int debug_event_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void debug_event_destroy( struct object *obj );
static const struct sync_ops debug_event_sync_ops = @@ -114,7 +114,7 @@ static const struct object_ops debug_event_ops =
static void debug_obj_dump( struct object *obj, int verbose ); static struct sync *debug_obj_get_sync( struct object *obj ); -static int debug_obj_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int debug_obj_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void debug_obj_destroy( struct object *obj );
static const struct sync_ops debug_obj_sync_ops = @@ -324,7 +324,7 @@ static struct sync *debug_event_get_sync( struct object *obj ) return debug_event->sync; }
-static int debug_event_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int debug_event_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct debug_event *debug_event = (struct debug_event *)obj; assert( obj->ops == &debug_event_ops ); @@ -356,7 +356,7 @@ static struct sync *debug_obj_get_sync( struct object *obj ) return debug_obj->sync; }
-static int debug_obj_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int debug_obj_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct debug_obj *debug_obj = (struct debug_obj *)obj; assert( obj->ops == &debug_obj_ops ); diff --git a/server/device.c b/server/device.c index 62dd7b70d07..45a9060bd6a 100644 --- a/server/device.c +++ b/server/device.c @@ -93,7 +93,7 @@ struct device_manager
static void device_manager_dump( struct object *obj, int verbose ); static struct sync *device_manager_get_sync( struct object *obj ); -static int device_manager_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int device_manager_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void device_manager_destroy( struct object *obj );
static const struct sync_ops device_manager_sync_ops = @@ -779,7 +779,7 @@ static struct sync *device_manager_get_sync( struct object *obj ) return manager->sync; }
-static int device_manager_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int device_manager_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct device_manager *manager = (struct device_manager *)obj;
diff --git a/server/event.c b/server/event.c index 85c9686f2c9..bca7a0010f0 100644 --- a/server/event.c +++ b/server/event.c @@ -62,9 +62,9 @@ struct event static void event_dump( struct object *obj, int verbose ); static struct sync *event_get_sync( struct object *obj ); static void event_destroy( struct object *obj ); -static int event_signaled( struct object *obj, struct wait_queue_entry *entry ); -static void event_satisfied( struct object *obj, struct wait_queue_entry *entry ); -static int event_signal( struct object *obj, unsigned int access); +static int event_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void event_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static int event_signal( struct sync *sync, struct object *obj, unsigned int access ); static struct list *event_get_kernel_obj_list( struct object *obj );
static const struct sync_ops event_sync_ops = @@ -122,7 +122,7 @@ struct keyed_event static void keyed_event_dump( struct object *obj, int verbose ); static struct sync *keyed_event_get_sync( struct object *obj ); static void keyed_event_destroy( struct object *obj ); -static int keyed_event_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int keyed_event_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry );
static const struct sync_ops keyed_event_sync_ops = { @@ -223,14 +223,14 @@ static void event_destroy( struct object *obj ) release_sync( event->sync ); }
-static int event_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int event_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct event *event = (struct event *)obj; assert( obj->ops == &event_ops ); return event->signaled; }
-static void event_satisfied( struct object *obj, struct wait_queue_entry *entry ) +static void event_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct event *event = (struct event *)obj; assert( obj->ops == &event_ops ); @@ -238,7 +238,7 @@ static void event_satisfied( struct object *obj, struct wait_queue_entry *entry if (!event->manual_reset) event->signaled = 0; }
-static int event_signal( struct object *obj, unsigned int access ) +static int event_signal( struct sync *sync, struct object *obj, unsigned int access ) { struct event *event = (struct event *)obj; assert( obj->ops == &event_ops ); @@ -303,10 +303,8 @@ static enum select_opcode matching_op( enum select_opcode op ) return op ^ (SELECT_KEYED_EVENT_WAIT ^ SELECT_KEYED_EVENT_RELEASE); }
-static int keyed_event_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int keyed_event_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { - struct keyed_event *event = (struct keyed_event *)obj; - struct sync *sync = event->sync; struct wait_queue_entry *ptr; struct process *process; enum select_opcode select_op; diff --git a/server/fd.c b/server/fd.c index aa16f097f40..6a9c1ecfe1f 100644 --- a/server/fd.c +++ b/server/fd.c @@ -159,7 +159,7 @@ struct fd
static void fd_dump( struct object *obj, int verbose ); static struct sync *fd_get_sync( struct object *obj ); -static int fd_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int fd_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void fd_destroy( struct object *obj );
const struct sync_ops fd_sync_ops = @@ -285,7 +285,7 @@ struct file_lock static void file_lock_dump( struct object *obj, int verbose ); static struct sync *file_lock_get_sync( struct object *obj ); static void file_lock_destroy( struct object *obj ); -static int file_lock_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int file_lock_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry );
static const struct sync_ops file_lock_sync_ops = { @@ -1262,7 +1262,7 @@ static void file_lock_destroy( struct object *obj ) release_sync( lock->sync ); }
-static int file_lock_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int file_lock_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct file_lock *lock = (struct file_lock *)obj; /* lock is signaled if it has lost its owner */ @@ -2203,7 +2203,7 @@ int check_fd_events( struct fd *fd, int events ) return pfd.revents; }
-static int fd_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int fd_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct fd *fd = get_obj_fd( obj ); int ret = fd->signaled; diff --git a/server/mutex.c b/server/mutex.c index 493f7f60ad7..761da93dd1f 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -62,10 +62,10 @@ struct mutex
static void mutex_dump( struct object *obj, int verbose ); static struct sync *mutex_get_sync( struct object *obj ); -static int mutex_signaled( struct object *obj, struct wait_queue_entry *entry ); -static void mutex_satisfied( struct object *obj, struct wait_queue_entry *entry ); +static int mutex_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void mutex_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void mutex_destroy( struct object *obj ); -static int mutex_signal( struct object *obj, unsigned int access ); +static int mutex_signal( struct sync *sync, struct object *obj, unsigned int access );
static const struct sync_ops mutex_sync_ops = { @@ -170,14 +170,14 @@ static struct sync *mutex_get_sync( struct object *obj ) return mutex->sync; }
-static int mutex_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int mutex_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct mutex *mutex = (struct mutex *)obj; assert( obj->ops == &mutex_ops ); return (!mutex->count || (mutex->owner == get_wait_queue_thread( entry ))); }
-static void mutex_satisfied( struct object *obj, struct wait_queue_entry *entry ) +static void mutex_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct mutex *mutex = (struct mutex *)obj; assert( obj->ops == &mutex_ops ); @@ -187,7 +187,7 @@ static void mutex_satisfied( struct object *obj, struct wait_queue_entry *entry mutex->abandoned = 0; }
-static int mutex_signal( struct object *obj, unsigned int access ) +static int mutex_signal( struct sync *sync, struct object *obj, unsigned int access ) { struct mutex *mutex = (struct mutex *)obj; assert( obj->ops == &mutex_ops ); diff --git a/server/object.c b/server/object.c index eead499e2c4..611fb1d9104 100644 --- a/server/object.c +++ b/server/object.c @@ -659,17 +659,17 @@ struct namespace *create_namespace( unsigned int hash_size )
/* functions for unimplemented/default object operations */
-int no_add_queue( struct object *obj, struct wait_queue_entry *entry ) +int no_add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); return 0; }
-void no_satisfied( struct object *obj, struct wait_queue_entry *entry ) +void no_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { }
-int no_signal( struct object *obj, unsigned int access ) +int no_signal( struct sync *sync, struct object *obj, unsigned int access ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); return 0; diff --git a/server/object.h b/server/object.h index 08ee577a91a..265478bb459 100644 --- a/server/object.h +++ b/server/object.h @@ -72,15 +72,15 @@ struct sync_ops /* destroy a sync object */ void (*destroy)(struct sync *); /* add a thread to the object wait queue */ - int (*add_queue)(struct object *,struct wait_queue_entry *); + int (*add_queue)(struct sync *,struct object *,struct wait_queue_entry *); /* remove a thread from the object wait queue */ - void (*remove_queue)(struct object *,struct wait_queue_entry *); + void (*remove_queue)(struct sync *,struct object *,struct wait_queue_entry *); /* is object signaled? */ - int (*signaled)(struct object *,struct wait_queue_entry *); + int (*signaled)(struct sync *,struct object *,struct wait_queue_entry *); /* wait satisfied */ - void (*satisfied)(struct object *,struct wait_queue_entry *); + void (*satisfied)(struct sync *,struct object *,struct wait_queue_entry *); /* signal an object */ - int (*signal)(struct object *, unsigned int); + int (*signal)(struct sync *,struct object *, unsigned int); };
struct sync @@ -187,9 +187,9 @@ extern void release_sync( void *obj ); extern struct object *find_object( const struct namespace *namespace, const struct unicode_str *name, unsigned int attributes ); extern struct object *find_object_index( const struct namespace *namespace, unsigned int index ); -extern int no_add_queue( struct object *obj, struct wait_queue_entry *entry ); -extern void no_satisfied( struct object *obj, struct wait_queue_entry *entry ); -extern int no_signal( struct object *obj, unsigned int access ); +extern int no_add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +extern void no_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +extern int no_signal( struct sync *sync, struct object *obj, unsigned int access ); extern void sync_destroy( struct sync *obj ); extern struct fd *no_get_fd( struct object *obj ); extern struct sync *no_get_sync( struct object *obj ); diff --git a/server/process.c b/server/process.c index 0201f92c44a..7edb5d2d1a6 100644 --- a/server/process.c +++ b/server/process.c @@ -90,7 +90,7 @@ struct type_descr process_type =
static void process_dump( struct object *obj, int verbose ); static struct sync *process_get_sync( struct object *obj ); -static int process_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int process_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static unsigned int process_map_access( struct object *obj, unsigned int access ); static struct security_descriptor *process_get_sd( struct object *obj ); static void process_poll_event( struct fd *fd, int event ); @@ -155,7 +155,7 @@ struct startup_info
static void startup_info_dump( struct object *obj, int verbose ); static struct sync *startup_info_get_sync( struct object *obj ); -static int startup_info_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int startup_info_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void startup_info_destroy( struct object *obj );
static const struct sync_ops startup_info_sync_ops = @@ -207,7 +207,7 @@ struct type_descr job_type =
static void job_dump( struct object *obj, int verbose ); static struct sync *job_get_sync( struct object *obj ); -static int job_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int job_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static int job_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void job_destroy( struct object *obj );
@@ -485,7 +485,7 @@ static struct sync *job_get_sync( struct object *obj ) return job->sync; }
-static int job_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int job_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct job *job = (struct job *)obj; return job->signaled; @@ -840,7 +840,7 @@ static struct sync *process_get_sync( struct object *obj ) return process->sync; }
-static int process_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int process_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct process *process = (struct process *)obj; return !process->running_threads; @@ -938,7 +938,7 @@ static struct sync *startup_info_get_sync( struct object *obj ) return info->sync; }
-static int startup_info_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int startup_info_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct startup_info *info = (struct startup_info *)obj; return info->process && info->process->startup_state != STARTUP_IN_PROGRESS; diff --git a/server/queue.c b/server/queue.c index d833fac033a..961eb7855e0 100644 --- a/server/queue.c +++ b/server/queue.c @@ -149,10 +149,10 @@ struct hotkey
static void msg_queue_dump( struct object *obj, int verbose ); static struct sync *msg_queue_get_sync( struct object *obj ); -static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *entry ); -static void msg_queue_remove_queue( struct object *obj, struct wait_queue_entry *entry ); -static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entry ); -static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ); +static int msg_queue_add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void msg_queue_remove_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static int msg_queue_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void msg_queue_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void msg_queue_destroy( struct object *obj ); static void msg_queue_poll_event( struct fd *fd, int event ); static void thread_input_dump( struct object *obj, int verbose ); @@ -1278,10 +1278,9 @@ static int is_queue_hung( struct msg_queue *queue ) return 1; }
-static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *entry ) +static int msg_queue_add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; - struct sync *sync = queue->sync;
/* a thread can only wait on its own queue */ if (get_wait_queue_thread(entry)->queue != queue) @@ -1292,16 +1291,15 @@ static int msg_queue_add_queue( struct object *obj, struct wait_queue_entry *ent
if (queue->fd && list_empty( &sync->wait_queue )) /* first on the queue */ set_fd_events( queue->fd, POLLIN ); - add_queue( obj, entry ); + add_queue( sync, obj, entry ); return 1; }
-static void msg_queue_remove_queue( struct object *obj, struct wait_queue_entry *entry ) +static void msg_queue_remove_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; - struct sync *sync = queue->sync;
- remove_queue( obj, entry ); + remove_queue( sync, obj, entry ); if (queue->fd && list_empty( &sync->wait_queue )) /* last on the queue is gone */ set_fd_events( queue->fd, 0 ); } @@ -1321,10 +1319,9 @@ static struct sync *msg_queue_get_sync( struct object *obj ) return queue->sync; }
-static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int msg_queue_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; - struct sync *sync = queue->sync; int ret = 0;
if (queue->fd) @@ -1339,7 +1336,7 @@ static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entr return ret || is_signaled( queue ); }
-static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ) +static void msg_queue_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; const queue_shm_t *queue_shm = queue->shared; diff --git a/server/semaphore.c b/server/semaphore.c index 716baf87369..95f9a8f7fa3 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -61,9 +61,9 @@ struct semaphore static void semaphore_dump( struct object *obj, int verbose ); static struct sync *semaphore_get_sync( struct object *obj ); static void semaphore_destroy( struct object *obj ); -static int semaphore_signaled( struct object *obj, struct wait_queue_entry *entry ); -static void semaphore_satisfied( struct object *obj, struct wait_queue_entry *entry ); -static int semaphore_signal( struct object *obj, unsigned int access ); +static int semaphore_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void semaphore_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static int semaphore_signal( struct sync *sync, struct object *obj, unsigned int access );
static const struct sync_ops semaphore_sync_ops = { @@ -164,14 +164,14 @@ static void semaphore_destroy( struct object *obj ) release_sync( semaphore->sync ); }
-static int semaphore_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int semaphore_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct semaphore *sem = (struct semaphore *)obj; assert( obj->ops == &semaphore_ops ); return (sem->count > 0); }
-static void semaphore_satisfied( struct object *obj, struct wait_queue_entry *entry ) +static void semaphore_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct semaphore *sem = (struct semaphore *)obj; assert( obj->ops == &semaphore_ops ); @@ -179,7 +179,7 @@ static void semaphore_satisfied( struct object *obj, struct wait_queue_entry *en sem->count--; }
-static int semaphore_signal( struct object *obj, unsigned int access ) +static int semaphore_signal( struct sync *sync, struct object *obj, unsigned int access ) { struct semaphore *sem = (struct semaphore *)obj; assert( obj->ops == &semaphore_ops ); diff --git a/server/thread.c b/server/thread.c index 43e09728f01..8774917b7c9 100644 --- a/server/thread.c +++ b/server/thread.c @@ -96,7 +96,7 @@ struct thread_apc
static void dump_thread_apc( struct object *obj, int verbose ); static struct sync *thread_apc_get_sync( struct object *obj ); -static int thread_apc_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int thread_apc_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void thread_apc_destroy( struct object *obj ); static void clear_apc_queue( struct list *queue );
@@ -150,7 +150,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 void context_destroy( struct object *obj ); -static int context_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int context_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry );
static const struct sync_ops context_sync_ops = { @@ -203,7 +203,7 @@ struct type_descr thread_type =
static void dump_thread( struct object *obj, int verbose ); static struct sync *thread_get_sync( struct object *obj ); -static int thread_signaled( struct object *obj, struct wait_queue_entry *entry ); +static int thread_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static unsigned int thread_map_access( struct object *obj, unsigned int access ); static void thread_poll_event( struct fd *fd, int event ); static struct list *thread_get_kernel_obj_list( struct object *obj ); @@ -486,7 +486,7 @@ static void context_destroy( struct object *obj ) release_sync( context->sync ); }
-static int context_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int context_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct context *context = (struct context *)obj; return context->status != STATUS_PENDING; @@ -681,7 +681,7 @@ static struct sync *thread_get_sync( struct object *obj ) return thread->sync; }
-static int thread_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int thread_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct thread *mythread = (struct thread *)obj; return (mythread->state == TERMINATED); @@ -710,7 +710,7 @@ static struct sync *thread_apc_get_sync( struct object *obj ) return apc->sync; }
-static int thread_apc_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int thread_apc_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct thread_apc *apc = (struct thread_apc *)obj; return apc->executed; @@ -977,9 +977,8 @@ int resume_thread( struct thread *thread ) }
/* add a thread to an object wait queue; return 1 if OK, 0 on error */ -int add_queue( struct object *obj, struct wait_queue_entry *entry ) +int add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { - struct sync *sync = obj->ops->get_sync( obj ); grab_object( obj ); entry->obj = obj; list_add_tail( &sync->wait_queue, &entry->entry ); @@ -987,7 +986,7 @@ int add_queue( struct object *obj, struct wait_queue_entry *entry ) }
/* remove a thread from an object wait queue */ -void remove_queue( struct object *obj, struct wait_queue_entry *entry ) +void remove_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { list_remove( &entry->entry ); release_object( obj ); @@ -1036,7 +1035,7 @@ static unsigned int end_wait( struct thread *thread, unsigned int status ) for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) { struct sync *sync = entry->obj->ops->get_sync( entry->obj ); - sync->ops->satisfied( entry->obj, entry ); + sync->ops->satisfied( sync, entry->obj, entry ); } } else @@ -1044,7 +1043,7 @@ static unsigned int end_wait( struct thread *thread, unsigned int status ) struct sync *sync; entry = wait->queues + status; sync = entry->obj->ops->get_sync( entry->obj ); - sync->ops->satisfied( entry->obj, entry ); + sync->ops->satisfied( sync, entry->obj, entry ); } status = wait->status; if (wait->abandoned) status += STATUS_ABANDONED_WAIT_0; @@ -1052,7 +1051,7 @@ static unsigned int end_wait( struct thread *thread, unsigned int status ) for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) { struct sync *sync = entry->obj->ops->get_sync( entry->obj ); - sync->ops->remove_queue( entry->obj, entry ); + sync->ops->remove_queue( sync, entry->obj, entry ); } if (wait->user) remove_timeout_user( wait->user ); free( wait ); @@ -1084,7 +1083,7 @@ static int wait_on( const union select_op *select_op, unsigned int count, struct struct object *obj = objects[i]; struct sync *sync = obj->ops->get_sync( obj ); entry->wait = wait; - if (!sync->ops->add_queue( obj, entry )) + if (!sync->ops->add_queue( sync, obj, entry )) { wait->count = i; end_wait( current, get_error() ); @@ -1140,7 +1139,7 @@ static int check_wait( struct thread *thread ) for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) { struct sync *sync = entry->obj->ops->get_sync( entry->obj ); - not_ok |= !sync->ops->signaled( entry->obj, entry ); + not_ok |= !sync->ops->signaled( sync, entry->obj, entry ); } if (!not_ok) return STATUS_WAIT_0; } @@ -1149,7 +1148,7 @@ static int check_wait( struct thread *thread ) for (i = 0, entry = wait->queues; i < wait->count; i++, entry++) { struct sync *sync = entry->obj->ops->get_sync( entry->obj ); - if (sync->ops->signaled( entry->obj, entry )) return i; + if (sync->ops->signaled( sync, entry->obj, entry )) return i; } }
@@ -1267,7 +1266,7 @@ static int signal_object( obj_handle_t handle ) if (obj) { struct sync *sync = obj->ops->get_sync( obj ); - ret = sync->ops->signal( obj, get_handle_access( current->process, handle ) ); + ret = sync->ops->signal( sync, obj, get_handle_access( current->process, handle ) ); release_object( obj ); } return ret; diff --git a/server/thread.h b/server/thread.h index 270bc7ed096..2ff31043287 100644 --- a/server/thread.h +++ b/server/thread.h @@ -115,8 +115,8 @@ extern void set_wait_status( struct wait_queue_entry *entry, int status ); extern void stop_thread( struct thread *thread ); extern int wake_thread( struct thread *thread ); extern int wake_thread_queue_entry( struct wait_queue_entry *entry ); -extern int add_queue( struct object *obj, struct wait_queue_entry *entry ); -extern void remove_queue( struct object *obj, struct wait_queue_entry *entry ); +extern int add_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +extern void remove_queue( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); extern void kill_thread( struct thread *thread, int violent_death ); extern void wake_up( struct object *obj, int max ); extern int thread_queue_apc( struct process *process, struct thread *thread, struct object *owner, const union apc_call *call_data ); diff --git a/server/timer.c b/server/timer.c index 8dec11e77c7..46190659e4e 100644 --- a/server/timer.c +++ b/server/timer.c @@ -66,8 +66,8 @@ struct timer
static void timer_dump( struct object *obj, int verbose ); static struct sync *timer_get_sync( struct object *obj ); -static int timer_signaled( struct object *obj, struct wait_queue_entry *entry ); -static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry ); +static int timer_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); +static void timer_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ); static void timer_destroy( struct object *obj );
static const struct sync_ops timer_sync_ops = @@ -218,14 +218,14 @@ static struct sync *timer_get_sync( struct object *obj ) return timer->sync; }
-static int timer_signaled( struct object *obj, struct wait_queue_entry *entry ) +static int timer_signaled( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct timer *timer = (struct timer *)obj; assert( obj->ops == &timer_ops ); return timer->signaled; }
-static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry ) +static void timer_satisfied( struct sync *sync, struct object *obj, struct wait_queue_entry *entry ) { struct timer *timer = (struct timer *)obj; assert( obj->ops == &timer_ops );