diff options
author | Marcus Brinkmann <marcus@gnu.org> | 2002-09-09 22:04:25 +0000 |
---|---|---|
committer | Marcus Brinkmann <marcus@gnu.org> | 2002-09-09 22:04:25 +0000 |
commit | 80a243f5e1ce1a023cb45c6ecfa9ccc2b83312d7 (patch) | |
tree | 21f975420d18143021535ac9af55184c15fa5377 /utils | |
parent | 18cfa8b70ce9a6a3572908115f98211f3fa9a367 (diff) | |
download | hurd-80a243f5e1ce1a023cb45c6ecfa9ccc2b83312d7.tar.gz hurd-80a243f5e1ce1a023cb45c6ecfa9ccc2b83312d7.tar.bz2 hurd-80a243f5e1ce1a023cb45c6ecfa9ccc2b83312d7.zip |
libcons/
2002-09-09 Marcus Brinkmann <marcus@gnu.org>
* Makefile (SRCS): Add vcons-scrollback.c.
* vcons-scrollback.c: New file.
* cons.h (struct vcons): Add SCROLLING member.
* file-changed.c: Include <assert.h>.
(cons_S_file_changed): Be careful to take VCONS->scrolling into
account when doing clipping and scrolling.
* cons-switch.c: Roll back to earlier version with vcons ->
vcons_entry adjustments. The user is now expected to hold a
reference to the VCONS.
* cons.h: Fix prototype, too.
* vcons-open.c (cons_vcons_open): Initialize VCONS->lock,
VCONS->input and VCONS->display.
utils/
2002-09-09 Marcus Brinkmann <marcus@gnu.org>
* console-ncurses.c (console_switch): Keep a reference to the port
instead refering to it by number.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ChangeLog | 3 | ||||
-rw-r--r-- | utils/console-ncurses.c | 36 |
2 files changed, 19 insertions, 20 deletions
diff --git a/utils/ChangeLog b/utils/ChangeLog index e5562a10..496edd80 100644 --- a/utils/ChangeLog +++ b/utils/ChangeLog @@ -1,5 +1,8 @@ 2002-09-09 Marcus Brinkmann <marcus@gnu.org> + * console-ncurses.c (console_switch): Keep a reference to the port + instead refering to it by number. + * console-ncurses.c: New global variable global_lock. (main): Initialize global_lock. (cons_vcons_activate): Removed. diff --git a/utils/console-ncurses.c b/utils/console-ncurses.c index fb0b4190..98c212f6 100644 --- a/utils/console-ncurses.c +++ b/utils/console-ncurses.c @@ -266,44 +266,40 @@ error_t console_switch (int id, int delta) { error_t err = 0; - int active_id; - cons_t cons; vcons_t vcons; - - mutex_lock (&global_lock); - if (!active_vcons) - { - mutex_unlock (&global_lock); - return 0; - } - cons = active_vcons->cons; - active_id = active_vcons->id; + vcons_t new_vcons; /* We must give up our global lock before we can call back into libcons. This is because cons_switch will lock CONS, and as other functions in libcons lock CONS while calling back into our functions which take the global lock (like cons_vcons_add), we - would deadlock. Because of this, we can not refer to our active - console directly, but we must refer to it by name (ID). XXX - Likewise, we can not really refer to CONS directly, but the - current implementation guarantees an eternal life span for - CONS. */ + would deadlock. So we acquire a reference for VCONS to make sure + it isn't deallocated while we are outside of the global lock. We + also know that */ + + mutex_lock (&global_lock); + vcons = active_vcons; + if (vcons) + ports_port_ref (vcons); mutex_unlock (&global_lock); - err = cons_switch (cons, active_id, id, delta, &vcons); + + err = cons_switch (vcons, id, delta, &new_vcons); if (!err) { mutex_lock (&global_lock); - if (active_vcons != vcons) + if (active_vcons != new_vcons) { cons_vcons_close (active_vcons); - active_vcons = vcons; + active_vcons = new_vcons; } - mutex_unlock (&vcons->lock); + mutex_unlock (&new_vcons->lock); + ports_port_deref (vcons); mutex_unlock (&global_lock); } return err; } + void cons_vcons_add (cons_t cons, vcons_list_t vcons_entry) { |