Author: mmlr Date: 2011-06-10 19:12:51 +0200 (Fri, 10 Jun 2011) New Revision: 42086 Changeset: https://dev.haiku-os.org/changeset/42086 Modified: haiku/trunk/src/add-ons/kernel/generic/tty/module.cpp haiku/trunk/src/add-ons/kernel/generic/tty/tty.cpp haiku/trunk/src/add-ons/kernel/generic/tty/tty_private.h Log: Remove the global lock and the documentation for it. It was specific to the tty driver and doesn't apply to the generic module. Modified: haiku/trunk/src/add-ons/kernel/generic/tty/module.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/tty/module.cpp 2011-06-10 13:43:06 UTC (rev 42085) +++ haiku/trunk/src/add-ons/kernel/generic/tty/module.cpp 2011-06-10 17:12:51 UTC (rev 42086) @@ -68,6 +68,7 @@ 0, //B_KEEP_LOADED, tty_module_std_ops }, + &tty_create, &tty_destroy, &tty_create_cookie, Modified: haiku/trunk/src/add-ons/kernel/generic/tty/tty.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/tty/tty.cpp 2011-06-10 13:43:06 UTC (rev 42085) +++ haiku/trunk/src/add-ons/kernel/generic/tty/tty.cpp 2011-06-10 17:12:51 UTC (rev 42086) @@ -41,14 +41,9 @@ Locking ------- - There are four locks involved. If more than one needs to be held at a + There are three locks involved. If more than one needs to be held at a time, they must be acquired in the order they are listed here. - gGlobalTTYLock: Guards open/close operations. When held, tty_open(), - tty_close(), tty_close_cookie() etc. won't be invoked by other threads, - cookies won't be added to/removed from TTYs, and tty::ref_count, - tty::open_count, tty_cookie::closed won't change. - gTTYCookieLock: Guards the access to the fields tty_cookie::{thread_count,closed}, or more precisely makes access to them atomic. thread_count is the number of threads currently using the cookie @@ -59,9 +54,8 @@ tty::lock: Guards the access to tty::{input_buffer,settings::{termios, window_size,pgrp_id}}. Moreover when held guarantees that tty::open_count - won't drop to zero (both gGlobalTTYLock and tty::lock must be held to - decrement it). A tty and the tty connected to it (master and slave) share - the same lock. + won't drop to zero. A tty and the tty connected to it (master and slave) + share the same lock. gTTYRequestLock: Guards access to tty::{reader,writer}_queue (most RequestQueue methods do the locking themselves (the lock is a @@ -863,8 +857,6 @@ #endif // 0 -/*! The global lock must be held. -*/ tty_cookie* tty_create_cookie(struct tty* tty, struct tty* otherTTY, uint32 openMode) { @@ -896,8 +888,6 @@ } -/*! The global lock must be held. -*/ void tty_destroy_cookie(tty_cookie* cookie) { @@ -917,8 +907,6 @@ } -/*! The global lock must be held. -*/ void tty_close_cookie(tty_cookie* cookie) { @@ -958,9 +946,7 @@ // For the removal of the cookie acquire the TTY's lock. This ensures, that // cookies will not be removed from a TTY (or added -- cf. add_tty_cookie()) - // as long as the TTY's lock is being held. This is required for the select - // support, since we need to iterate through the cookies of a TTY without - // having to acquire the global lock. + // as long as the TTY's lock is being held. MutexLocker ttyLocker(cookie->tty->lock); // remove the cookie from the TTY's cookie list Modified: haiku/trunk/src/add-ons/kernel/generic/tty/tty_private.h =================================================================== --- haiku/trunk/src/add-ons/kernel/generic/tty/tty_private.h 2011-06-10 13:43:06 UTC (rev 42085) +++ haiku/trunk/src/add-ons/kernel/generic/tty/tty_private.h 2011-06-10 17:12:51 UTC (rev 42086) @@ -142,7 +142,6 @@ }; -extern struct mutex gGlobalTTYLock; extern struct mutex gTTYCookieLock; extern struct recursive_lock gTTYRequestLock;