1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
24 */
25
26 /*
27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
31 /*
32 *
33 * MODULE: dapl_evd_set_unwaitable.c
34 *
35 * PURPOSE: EVENT management
36 * Description: Interfaces in this file are completely described in
37 * the DAPL 1.1 API, Chapter 6, section 3.4.7
38 *
39 * $Id: dapl_evd_set_unwaitable.c,v 1.2 2003/08/20 13:18:36 sjs2 Exp $
40 */
41
42 #include "dapl.h"
43
44 /*
45 * dapl_evd_set_unwaitable
46 *
47 * DAPL Requirements Version 1.1, 6.3.4.7
48 *
49 * Transition the Event Dispatcher into an unwaitable state
50 *
51 * Input:
52 * evd_handle
53 *
54 * Output:
55 * none
56 *
57 * Returns:
58 * DAT_SUCCESS
59 * DAT_INVALID_HANDLE
60 */
61 DAT_RETURN
dapl_evd_set_unwaitable(IN DAT_EVD_HANDLE evd_handle)62 dapl_evd_set_unwaitable(
63 IN DAT_EVD_HANDLE evd_handle)
64 {
65 DAPL_EVD *evd_ptr;
66 DAT_RETURN dat_status;
67
68 evd_ptr = (DAPL_EVD *)evd_handle;
69 dat_status = DAT_SUCCESS;
70
71 if (DAPL_BAD_HANDLE(evd_handle, DAPL_MAGIC_EVD)) {
72 dat_status = DAT_ERROR(DAT_INVALID_HANDLE, 0);
73 goto bail;
74 }
75 dapl_os_lock(&evd_ptr->header.lock);
76 evd_ptr->evd_waitable = DAT_FALSE;
77 dapl_os_unlock(&evd_ptr->header.lock);
78
79 /*
80 * If this evd is waiting, wake it up. There is an obvious race
81 * condition here where we may wakeup the waiter before it goes to
82 * sleep; but the wait_object allows this and will do the right
83 * thing.
84 */
85 if (evd_ptr->evd_state == DAPL_EVD_STATE_WAITED) {
86 (void) dapl_os_wait_object_wakeup(&evd_ptr->wait_object);
87 }
88 bail:
89 return (dat_status);
90 }
91
92 /*
93 * Local variables:
94 * c-indent-level: 4
95 * c-basic-offset: 4
96 * tab-width: 8
97 * End:
98 */
99