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.
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.
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]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
29 #include <sys/machlock.h>
36 * Common definition for a sleep queue,
37 * be it an old-style sleep queue, or
38 * a constituent of a turnstile.
41 typedef struct sleepq
{
42 struct _kthread
*sq_first
;
46 * Definition of the head of a sleep queue hash bucket.
48 typedef struct _sleepq_head
{
56 #define SQHASHINDEX(X) \
57 ((((uintptr_t)(X) >> 2) ^ ((uintptr_t)(X) >> 13) ^ \
58 ((uintptr_t)(X) >> 24)) & (NSLEEPQ - 1))
59 #define SQHASH(X) (&sleepq_head[SQHASHINDEX(X)])
61 extern sleepq_head_t sleepq_head
[NSLEEPQ
];
63 extern void sleepq_insert(sleepq_t
*, struct _kthread
*);
64 extern struct _kthread
*sleepq_wakeone_chan(sleepq_t
*, void *);
65 extern void sleepq_wakeall_chan(sleepq_t
*, void *);
66 extern void sleepq_unsleep(struct _kthread
*);
67 extern void sleepq_dequeue(struct _kthread
*);
68 extern void sleepq_unlink(struct _kthread
**, struct _kthread
*);
76 #endif /* _SYS_SLEEPQ_H */