Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/ntirpc/rpc/pool_queue.h
$ cat -n /usr/include/ntirpc/rpc/pool_queue.h 1 /* 2 * Copyright (c) 2013-2015 CohortFS, LLC. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26 /** 27 * @file pool_queue.h 28 * @author William Allen Simpson
29 * @brief Pthreads-based TAILQ package 30 * 31 * @section DESCRIPTION 32 * 33 * This provides simple queues using pthreads and TAILQ primitives. 34 * 35 * @note Loosely based upon previous wait_queue by 36 * Matt Benjamin
37 */ 38 39 #ifndef POOL_QUEUE_H 40 #define POOL_QUEUE_H 41 42 #include
43 #include
44 #include
45 46 struct poolq_entry { 47 TAILQ_ENTRY(poolq_entry) q; /*** 1st ***/ 48 u_int qsize; /* allocated size of q entry, 49 * 0: default size */ 50 uint16_t qflags; 51 }; 52 53 struct poolq_head { 54 TAILQ_HEAD(poolq_head_s, poolq_entry) qh; 55 pthread_mutex_t qmutex; 56 57 u_int qsize; /* default size of q entries, 58 * 0: static size */ 59 int qcount; /* number of entries, 60 * < 0: has waiting workers. */ 61 }; 62 63 static inline void 64 poolq_head_destroy(struct poolq_head *qh) 65 { 66 pthread_mutex_destroy(&qh->qmutex); 67 } 68 69 static inline void 70 poolq_head_setup(struct poolq_head *qh) 71 { 72 TAILQ_INIT(&qh->qh); 73 pthread_mutex_init(&qh->qmutex, NULL); 74 qh->qcount = 0; 75 } 76 77 #endif /* POOL_QUEUE_H */
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™