In console input record queue, replace semaphore with a manual reset
event, so that we get correct behavior in synchronization handling.
diff --git a/server/console.c b/server/console.c
index a0687c8..3a295db 100644
--- a/server/console.c
+++ b/server/console.c
@@ -203,7 +203,7 @@
return evt;
}
-static struct object *create_console_input( struct thread* renderer, struct object* wait_obj )
+static struct object *create_console_input( struct thread* renderer )
{
struct console_input *console_input;
@@ -222,7 +222,7 @@
console_input->history_index = 0;
console_input->history_mode = 0;
console_input->edition_mode = 0;
- console_input->wait_obj = wait_obj;
+ console_input->event = create_event( NULL, 0, 1, 0 );
if (!console_input->history || !console_input->evt)
{
@@ -514,9 +514,8 @@
else i++;
}
}
+ if (!console->recnum && count) set_event( console->event );
console->recnum += count;
- /* wake up all waiters */
- wake_up( &console->obj, 0 );
return count;
}
@@ -555,6 +554,7 @@
{
free( console->records );
console->records = NULL;
+ reset_event( console->event );
}
}
release_object( console );
@@ -943,7 +943,7 @@
release_object( console_in->evt );
console_in->evt = NULL;
- release_object( console_in->wait_obj );
+ release_object( console_in->event );
for (i = 0; i < console_in->history_size; i++)
if (console_in->history[i]) free( console_in->history[i] );
@@ -1209,7 +1209,6 @@
struct process *process;
struct process *renderer = current->process;
struct console_input *console;
- struct object *wait_event;
process = (req->pid) ? get_process_from_id( req->pid ) :
(struct process *)grab_object( renderer->parent );
@@ -1222,13 +1221,7 @@
set_error( STATUS_ACCESS_DENIED );
goto the_end;
}
- wait_event = get_handle_obj( renderer, req->wait_event, 0, NULL);
- if (!wait_event)
- {
- set_error( STATUS_INVALID_PARAMETER );
- goto the_end;
- }
- if ((console = (struct console_input*)create_console_input( current, wait_event )))
+ if ((console = (struct console_input*)create_console_input( current )))
{
if ((in = alloc_handle( renderer, console, req->access, req->inherit )))
{
@@ -1531,8 +1524,8 @@
if (console)
{
- reply->handle = alloc_handle( current->process, console->wait_obj,
- SEMAPHORE_ALL_ACCESS, FALSE);
+ reply->handle = alloc_handle( current->process, console->event,
+ EVENT_ALL_ACCESS, FALSE);
release_object( console );
}
else set_error( STATUS_INVALID_PARAMETER );
diff --git a/server/console.h b/server/console.h
index 95bae25..2fdb9d5 100644
--- a/server/console.h
+++ b/server/console.h
@@ -42,7 +42,7 @@
int history_index; /* number of used entries in history array */
int history_mode; /* mode of history (non zero means remove doubled strings */
int edition_mode; /* index to edition mode flavors */
- struct object *wait_obj; /* object to wait on for input queue */
+ struct event *event; /* event to wait on for input queue */
};
/* console functions */
diff --git a/server/protocol.def b/server/protocol.def
index c117b41..fb820a8 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -775,7 +775,6 @@
unsigned int access; /* wanted access rights */
int inherit; /* inherit flag */
process_id_t pid; /* pid of process which shall be attached to the console */
- obj_handle_t wait_event; /* semaphore for number of active input events */
@REPLY
obj_handle_t handle_in; /* handle to console input */
obj_handle_t event; /* handle to renderer events change notification */
diff --git a/server/trace.c b/server/trace.c
index ae215d0..1e93cb1 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -997,8 +997,7 @@
{
fprintf( stderr, " access=%08x,", req->access );
fprintf( stderr, " inherit=%d,", req->inherit );
- fprintf( stderr, " pid=%04x,", req->pid );
- fprintf( stderr, " wait_event=%p", req->wait_event );
+ fprintf( stderr, " pid=%04x", req->pid );
}
static void dump_alloc_console_reply( const struct alloc_console_reply *req )