diff options
author | Michael I. Bushnell <mib@gnu.org> | 1993-12-03 02:02:01 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1993-12-03 02:02:01 +0000 |
commit | 7cf2b886267980bfe10e5c39d9fb74d0795b97c3 (patch) | |
tree | 57854728a271909396ce87c8470e27f3db593be0 | |
parent | 99be20e0687fff63642da6f753f56427b0ba4efc (diff) |
Initial revision
-rw-r--r-- | libiohelp/handle_io_release_conch.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/libiohelp/handle_io_release_conch.c b/libiohelp/handle_io_release_conch.c new file mode 100644 index 00000000..8628f465 --- /dev/null +++ b/libiohelp/handle_io_release_conch.c @@ -0,0 +1,42 @@ +/* + Copyright (C) 1993 Free Software Foundation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +error_t +handle_io_release_conch (struct conch *c, void *user) +{ + error_t error; + + mutex_lock (&c->lock); + + if (c->holder_shared_page->conch_status != USER_HAS_NOT_CONCH) + { + c->holder_shared_page->conch_status = USER_HAS_NOT_CONCH; + error = fetch_shared_data (c->holder); + } + + if (c->holder == user) + { + c->holder = 0; + c->holder_shared_page = 0; + } + + condition_broadcast (&c->wait); + mutex_unlock (&c->lock); + + return error; +} + |