00001 /*<std-header orig-src='shore' incl-file-exclusion='STCORE_PTHREAD_H'> 00002 00003 $Id: stcore_pthread.h,v 1.10 2010/12/09 15:20:17 nhall Exp $ 00004 00005 SHORE -- Scalable Heterogeneous Object REpository 00006 00007 Copyright (c) 1994-99 Computer Sciences Department, University of 00008 Wisconsin -- Madison 00009 All Rights Reserved. 00010 00011 Permission to use, copy, modify and distribute this software and its 00012 documentation is hereby granted, provided that both the copyright 00013 notice and this permission notice appear in all copies of the 00014 software, derivative works or modified versions, and any portions 00015 thereof, and that both notices appear in supporting documentation. 00016 00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY 00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS 00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND 00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 00021 00022 This software was developed with support by the Advanced Research 00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by 00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518. 00025 Further funding for this work was provided by DARPA through 00026 Rome Research Laboratory Contract No. F30602-97-2-0247. 00027 00028 */ 00029 00030 #ifndef STCORE_PTHREAD_H 00031 #define STCORE_PTHREAD_H 00032 00033 #include "w_defines.h" 00034 00035 /* -- do not edit anything above this line -- </std-header>*/ 00036 00037 /* 00038 * NewThreads is Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998 by: 00039 * 00040 * Josef Burger <bolo@cs.wisc.edu> 00041 * Dylan McNamee <dylan@cse.ogi.edu> 00042 * Ed Felten <felten@cs.princeton.edu> 00043 * 00044 * All Rights Reserved. 00045 * 00046 * NewThreads may be freely used as long as credit is given 00047 * to the above authors and the above copyright is maintained. 00048 */ 00049 00050 #include <w_pthread.h> 00051 #ifdef HAVE_SEMAPHORE_H 00052 #include <semaphore.h> 00053 #endif 00054 00055 /**\cond skip */ 00056 typedef struct sthread_core_t { 00057 int is_virgin; /* TRUE if just started */ 00058 void (*start_proc)(void *); /* thread start function */ 00059 void *start_arg; /* argument for start_proc */ 00060 int stack_size; /* stack size */ 00061 void *sthread; /* sthread which uses this core */ 00062 pthread_t pthread; 00063 pthread_t creator; /* thread that created this pthread, for 00064 debugging only */ 00065 } sthread_core_t; 00066 /**\endcond skip */ 00067 00068 ostream &operator<<(ostream &o, const sthread_core_t &core); 00069 00070 extern int sthread_core_init(sthread_core_t* t, 00071 void (*proc)(void *), void *arg, 00072 unsigned stack_size); 00073 00074 extern void sthread_core_exit(sthread_core_t *t, bool &joined); 00075 00076 /*<std-footer incl-file-exclusion='STCORE_PTHREAD_H'> -- do not edit anything below this line -- */ 00077 00078 #endif /*</std-footer>*/