From 7648503cd894549874ff13f7ed94a4708cf50f0d Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Mon, 3 Sep 2012 15:47:25 +0200 Subject: Remove condition implications There is no equivalent for these functions in libpthread. Instead of adding them as non standard extensions, rework their use. * console-client/kbd-repeat.c (kbd_repeat_key): Wake threads waiting on select_alert. (kbd_setrepeater): Remove call to condition_implies. console-client/pc-mouse.c (repeat_event): Wake threads waiting on select_alert. (setrepeater): Remove call to condition_implies. * libpipe/pipe.c (pipe_create): Initialize the `pending_selects' member. (pipe_add_select_cond): New function. (pipe_remove_select_cond): Likewise. (pipe_select_cond_broadcast): Likewise. (_pipe_no_readers): Wake threads waiting on a pending select. (_pipe_no_writers): Likewise. (pipe_send): Likewise. (pipe_recv): Likewise. (pipe_pair_select): Replace condition implications by installing a pending select on the pair of pipes. * libpipe/pipe.h (struct pipe_select_cond): New type. (struct pipe): New member `pending_selects'. * pfinet/tunnel.c (tunnel_xmit): Wake threads waiting on tdev->select_alert. (setup_tunnel_device): Remove call to condition_implies. * term/devio.c (device_write_reply_inband): Wake threads waiting on select_alert. * term/hurdio.c (hurdio_writer_loop): Likewise. * term/main.c (main): Remove calls to condition_implies. * term/ptyio.c (ptyio_init): Remove calls to condition_implies, initialize pty_select_alert. (wake_reader): Wake threads waiting on pty_select_wakeup. * term/term.h (pty_select_alert): New variable. (clear_queue): Wake threads waiting on select_alert and, if acting on the input queue, pty_select_alert, unless it's NULL. (dequeue_quote): Likewise. (enqueue_internal): Likewise. (queue_erase): Likewise. * trans/streamio.c (clear_buffer): Wake threads waiting on select_alert. (buffer_read): Likewise. (buffer_write): Likewise. (device_read_reply_inband): Likewise. (device_write_reply_inband): Likewise. (main): Remove calls to condition_implies. --- console-client/kbd-repeat.c | 3 +-- console-client/pc-mouse.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'console-client') diff --git a/console-client/kbd-repeat.c b/console-client/kbd-repeat.c index 4bf9268e..b9000b22 100644 --- a/console-client/kbd-repeat.c +++ b/console-client/kbd-repeat.c @@ -81,6 +81,7 @@ kbd_repeat_key (kd_event *key) memcpy (ev, key, sizeof (kd_event)); condition_broadcast (&kbdbuf.readcond); + condition_broadcast (&select_alert); mutex_unlock (&global_lock); } @@ -231,9 +232,7 @@ kbd_setrepeater (const char *nodename, consnode_t *cn) condition_init (&kbdbuf.readcond); condition_init (&kbdbuf.writecond); - condition_init (&select_alert); - condition_implies (&kbdbuf.readcond, &select_alert); console_register_consnode (*cn); diff --git a/console-client/pc-mouse.c b/console-client/pc-mouse.c index cf8987bf..8a9009fb 100644 --- a/console-client/pc-mouse.c +++ b/console-client/pc-mouse.c @@ -105,6 +105,7 @@ repeat_event (kd_event *evt) memcpy (ev, evt, sizeof (kd_event)); condition_broadcast (&mousebuf.readcond); + condition_broadcast (&select_alert); mutex_unlock (&global_lock); } @@ -499,9 +500,7 @@ setrepeater (const char *nodename) condition_init (&mousebuf.readcond); condition_init (&mousebuf.writecond); - condition_init (&select_alert); - condition_implies (&mousebuf.readcond, &select_alert); console_register_consnode (cnode); -- cgit v1.2.3