Remove the global lock and the documentation for it. It was specific to the tty

driver and doesn't apply to the generic module.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42086 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2011-06-10 17:12:51 +00:00
parent 9254b0c4df
commit 6e72f897f4
3 changed files with 5 additions and 19 deletions
@@ -68,6 +68,7 @@ static struct tty_module_info sTTYModule = {
0, //B_KEEP_LOADED, 0, //B_KEEP_LOADED,
tty_module_std_ops tty_module_std_ops
}, },
&tty_create, &tty_create,
&tty_destroy, &tty_destroy,
&tty_create_cookie, &tty_create_cookie,
+4 -18
View File
@@ -41,14 +41,9 @@
Locking 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. 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 gTTYCookieLock: Guards the access to the fields
tty_cookie::{thread_count,closed}, or more precisely makes access to them tty_cookie::{thread_count,closed}, or more precisely makes access to them
atomic. thread_count is the number of threads currently using the cookie 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, tty::lock: Guards the access to tty::{input_buffer,settings::{termios,
window_size,pgrp_id}}. Moreover when held guarantees that tty::open_count 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 won't drop to zero. A tty and the tty connected to it (master and slave)
decrement it). A tty and the tty connected to it (master and slave) share share the same lock.
the same lock.
gTTYRequestLock: Guards access to tty::{reader,writer}_queue (most gTTYRequestLock: Guards access to tty::{reader,writer}_queue (most
RequestQueue methods do the locking themselves (the lock is a RequestQueue methods do the locking themselves (the lock is a
@@ -863,8 +857,6 @@ tty_input_putc(struct tty* tty, int c)
#endif // 0 #endif // 0
/*! The global lock must be held.
*/
tty_cookie* tty_cookie*
tty_create_cookie(struct tty* tty, struct tty* otherTTY, uint32 openMode) tty_create_cookie(struct tty* tty, struct tty* otherTTY, uint32 openMode)
{ {
@@ -896,8 +888,6 @@ tty_create_cookie(struct tty* tty, struct tty* otherTTY, uint32 openMode)
} }
/*! The global lock must be held.
*/
void void
tty_destroy_cookie(tty_cookie* cookie) tty_destroy_cookie(tty_cookie* cookie)
{ {
@@ -917,8 +907,6 @@ tty_destroy_cookie(tty_cookie* cookie)
} }
/*! The global lock must be held.
*/
void void
tty_close_cookie(tty_cookie* cookie) tty_close_cookie(tty_cookie* cookie)
{ {
@@ -958,9 +946,7 @@ tty_close_cookie(tty_cookie* cookie)
// For the removal of the cookie acquire the TTY's lock. This ensures, that // 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()) // 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 // as long as the TTY's lock is being held.
// support, since we need to iterate through the cookies of a TTY without
// having to acquire the global lock.
MutexLocker ttyLocker(cookie->tty->lock); MutexLocker ttyLocker(cookie->tty->lock);
// remove the cookie from the TTY's cookie list // remove the cookie from the TTY's cookie list
@@ -142,7 +142,6 @@ struct tty {
}; };
extern struct mutex gGlobalTTYLock;
extern struct mutex gTTYCookieLock; extern struct mutex gTTYCookieLock;
extern struct recursive_lock gTTYRequestLock; extern struct recursive_lock gTTYRequestLock;