Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/ntirpc/misc/wait_queue.h
$ cat -n /usr/include/ntirpc/misc/wait_queue.h 1 /* 2 * Copyright (c) 2013 Linux Box Corporation. 3 * Copyright (c) 2013-2017 Red Hat, Inc. and/or its affiliates. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #ifndef WAIT_QUEUE_H 28 #define WAIT_QUEUE_H 29 30 #include
31 #include
32 #include
33 #include
34 #include
35 #include
36 37 struct waitq_entry { 38 mutex_t mtx; 39 cond_t cv; 40 }; 41 42 #define Wqe_LFlag_None 0x0000 43 #define Wqe_LFlag_WaitSync 0x0001 44 #define Wqe_LFlag_SyncDone 0x0002 45 46 /* thread wait queue */ 47 struct waitq_head { 48 TAILQ_HEAD(waitq_head_s, waiter) waitq; 49 struct waitq_entry lwe; /* left */ 50 struct waitq_entry rwe; /* right */ 51 uint32_t flags; 52 uint32_t waiters; 53 }; 54 55 static inline void waitq_entry_init(struct waitq_entry *we) 56 { 57 mutex_init(&we->mtx, NULL); 58 pthread_cond_init(&we->cv, NULL); 59 } 60 61 static inline void waitq_entry_destroy(struct waitq_entry *we) 62 { 63 mutex_destroy(&we->mtx); 64 cond_destroy(&we->cv); 65 } 66 67 static inline void waitq_head_init(struct waitq_head *wqe) 68 { 69 TAILQ_INIT(&wqe->waitq); 70 waitq_entry_init(&wqe->lwe); 71 waitq_entry_init(&wqe->rwe); 72 } 73 74 static inline void waitq_head_destroy(struct waitq_head *wqe) 75 { 76 TAILQ_INIT(&wqe->waitq); 77 waitq_entry_destroy(&wqe->lwe); 78 waitq_entry_destroy(&wqe->rwe); 79 } 80 81 #endif /* WAIT_QUEUE_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™