|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * The contents of this file constitute Original Code as defined in and ! 7: * are subject to the Apple Public Source License Version 1.1 (the ! 8: * "License"). You may not use this file except in compliance with the ! 9: * License. Please obtain a copy of the License at ! 10: * http://www.apple.com/publicsource and read it before using this file. ! 11: * ! 12: * This Original Code and all software distributed under the License are ! 13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 17: * License for the specific language governing rights and limitations ! 18: * under the License. ! 19: * ! 20: * @APPLE_LICENSE_HEADER_END@ ! 21: */ ! 22: /* ! 23: * @OSF_FREE_COPYRIGHT@ ! 24: */ ! 25: /* ! 26: * HISTORY ! 27: * ! 28: * Revision 1.1.1.1 1998/09/22 21:05:32 wsanchez ! 29: * Import of Mac OS X kernel (~semeria) ! 30: * ! 31: * Revision 1.1.1.1 1998/03/07 02:25:57 wsanchez ! 32: * Import of OSF Mach kernel (~mburg) ! 33: * ! 34: * Revision 1.1.7.4 1995/01/18 18:35:03 ezf ! 35: * updated Utah CR notice ! 36: * [1995/01/18 18:30:36 ezf] ! 37: * ! 38: * Revision 1.1.7.3 1995/01/10 05:15:24 devrcs ! 39: * mk6 CR801 - merge up from nmk18b4 to nmk18b7 ! 40: * * Rev 1.1.8.2 1994/11/08 15:33:03 watkins ! 41: * Add declaration for thread_pool_put_act. ! 42: * [1994/12/09 21:10:56 dwm] ! 43: * ! 44: * Revision 1.1.7.1 1994/09/23 02:31:15 ezf ! 45: * change marker to not FREE ! 46: * [1994/09/22 21:38:04 ezf] ! 47: * ! 48: * Revision 1.1.2.9 1994/06/09 14:14:07 dswartz ! 49: * Preemption merge. ! 50: * [1994/06/09 14:08:37 dswartz] ! 51: * ! 52: * Revision 1.1.2.8 1994/06/01 19:30:14 bolinger ! 53: * mk6 CR125: Update to reflect changes in access to thread_pool ! 54: * of a thread_act. ! 55: * [1994/06/01 19:18:25 bolinger] ! 56: * ! 57: * Revision 1.1.2.7 1994/03/17 22:38:37 dwm ! 58: * The infamous name change: thread_activation + thread_shuttle = thread. ! 59: * [1994/03/17 21:28:18 dwm] ! 60: * ! 61: * Revision 1.1.2.6 1994/02/09 00:42:42 dwm ! 62: * Put a variety of debugging code under MACH_ASSERT, ! 63: * to enhance PROD performance a bit. ! 64: * [1994/02/09 00:35:13 dwm] ! 65: * ! 66: * Revision 1.1.2.5 1994/01/21 23:45:08 dwm ! 67: * Thread_pools now embedded directly in port/pset, ! 68: * delete refcount, modify protos. ! 69: * [1994/01/21 23:43:13 dwm] ! 70: * ! 71: * Revision 1.1.2.4 1994/01/17 19:09:32 dwm ! 72: * Fix ref/dealloc macros, missing semicolon. ! 73: * [1994/01/17 19:09:16 dwm] ! 74: * ! 75: * Revision 1.1.2.3 1994/01/17 18:08:57 dwm ! 76: * Add finer grained act tracing. ! 77: * [1994/01/17 16:06:54 dwm] ! 78: * ! 79: * Revision 1.1.2.2 1994/01/14 18:42:05 bolinger ! 80: * Update to reflect thread_pool_block() -> thread_pool_get_act() name ! 81: * change. ! 82: * [1994/01/14 18:18:40 bolinger] ! 83: * ! 84: * Revision 1.1.2.1 1994/01/12 17:53:21 dwm ! 85: * Coloc: initial restructuring to follow Utah model. ! 86: * [1994/01/12 17:15:24 dwm] ! 87: * ! 88: * $EndLog$ ! 89: */ ! 90: /* ! 91: * Copyright (c) 1993 The University of Utah and ! 92: * the Computer Systems Laboratory (CSL). All rights reserved. ! 93: * ! 94: * Permission to use, copy, modify and distribute this software and its ! 95: * documentation is hereby granted, provided that both the copyright ! 96: * notice and this permission notice appear in all copies of the ! 97: * software, derivative works or modified versions, and any portions ! 98: * thereof, and that both notices appear in supporting documentation. ! 99: * ! 100: * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS ! 101: * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF ! 102: * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 103: * ! 104: * CSL requests users of this software to return to [email protected] any ! 105: * improvements that they make and grant CSL redistribution rights. ! 106: * ! 107: * Author: Bryan Ford, University of Utah CSL ! 108: * ! 109: * File: thread_pool.h ! 110: * ! 111: * Defines the thread_pool: a pool of available activations. ! 112: * ! 113: */ ! 114: ! 115: #ifndef _KERN_THREAD_POOL_H_ ! 116: #define _KERN_THREAD_POOL_H_ ! 117: ! 118: #include <mach/kern_return.h> ! 119: #include <kern/lock.h> ! 120: #include <mach_assert.h> ! 121: ! 122: typedef struct thread_pool { ! 123: ! 124: /* List of available activations, all active but not in use. */ ! 125: struct thread_activation *thr_acts; ! 126: ! 127: /* true if somebody is waiting for an activation from this pool */ ! 128: int waiting; ! 129: ! 130: } thread_pool, *thread_pool_t; ! 131: #define THREAD_POOL_NULL ((thread_pool_t)0) ! 132: ! 133: /* Exported to kern/startup.c only */ ! 134: kern_return_t thread_pool_init(thread_pool_t new_thread_pool); ! 135: ! 136: /* Get an activation from a thread_pool, blocking if need be */ ! 137: extern struct thread_activation *thread_pool_get_act( ipc_port_t ); ! 138: extern void thread_pool_put_act( thread_act_t ); ! 139: ! 140: /* Wake up a waiter upon return to thread_pool */ ! 141: extern void thread_pool_wakeup( thread_pool_t ); ! 142: ! 143: #if MACH_ASSERT ! 144: /* ! 145: * Debugging support - "watchacts", a patchable selective trigger ! 146: */ ! 147: extern unsigned int watchacts; /* debug printf trigger */ ! 148: #define WA_SCHED 0x001 /* kern/sched_prim.c */ ! 149: #define WA_THR 0x002 /* kern/thread.c */ ! 150: #define WA_ACT_LNK 0x004 /* kern/thread_act.c act mgmt */ ! 151: #define WA_ACT_HDLR 0x008 /* kern/thread_act.c act hldrs */ ! 152: #define WA_TASK 0x010 /* kern/task.c */ ! 153: #define WA_BOOT 0x020 /* bootstrap,startup.c */ ! 154: #define WA_PCB 0x040 /* machine/pcb.c */ ! 155: #define WA_PORT 0x080 /* ports + port sets */ ! 156: #define WA_EXIT 0x100 /* exit path */ ! 157: #define WA_SWITCH 0x200 /* context switch (!!) */ ! 158: #define WA_STATE 0x400 /* get/set state (!!) */ ! 159: #define WA_ALL (~0) ! 160: #endif /* MACH_ASSERT */ ! 161: ! 162: #endif /* _KERN_THREAD_POOL_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.