00001 00002 /* -*- mode:C++; c-basic-offset:4 -*- 00003 Shore-MT -- Multi-threaded port of the SHORE storage manager 00004 00005 Copyright (c) 2007-2009 00006 Data Intensive Applications and Systems Labaratory (DIAS) 00007 Ecole Polytechnique Federale de Lausanne 00008 00009 All Rights Reserved. 00010 00011 Permission to use, copy, modify and distribute this software and 00012 its documentation is hereby granted, provided that both the 00013 copyright notice and this permission notice appear in all copies of 00014 the software, derivative works or modified versions, and any 00015 portions thereof, and that both notices appear in supporting 00016 documentation. 00017 00018 This code is distributed in the hope that it will be useful, but 00019 WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS 00021 DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER 00022 RESULTING FROM THE USE OF THIS SOFTWARE. 00023 */ 00024 00025 // -*- mode:c++; c-basic-offset:4 -*- 00026 /*<std-header orig-src='shore'> 00027 00028 $Id: sthread.cpp,v 1.328 2010/07/19 18:35:15 nhall Exp $ 00029 00030 SHORE -- Scalable Heterogeneous Object REpository 00031 00032 Copyright (c) 1994-99 Computer Sciences Department, University of 00033 Wisconsin -- Madison 00034 All Rights Reserved. 00035 00036 Permission to use, copy, modify and distribute this software and its 00037 documentation is hereby granted, provided that both the copyright 00038 notice and this permission notice appear in all copies of the 00039 software, derivative works or modified versions, and any portions 00040 thereof, and that both notices appear in supporting documentation. 00041 00042 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY 00043 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS 00044 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND 00045 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 00046 00047 This software was developed with support by the Advanced Research 00048 Project Agency, ARPA order number 018 (formerly 8230), monitored by 00049 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518. 00050 Further funding for this work was provided by DARPA through 00051 Rome Research Laboratory Contract No. F30602-97-2-0247. 00052 00053 */ 00054 00055 #include "w_defines.h" 00056 00057 /* -- do not edit anything above this line -- </std-header>*/ 00058 00059 00060 /* 00061 * NewThreads is Copyright 1992, 1993, 1994, 1995, 1996, 1997 by: 00062 * 00063 * Josef Burger <bolo@cs.wisc.edu> 00064 * Dylan McNamee <dylan@cse.ogi.edu> 00065 * Ed Felten <felten@cs.princeton.edu> 00066 * 00067 * All Rights Reserved. 00068 * 00069 * NewThreads may be freely used as long as credit is given 00070 * to the above authors and the above copyright is maintained. 00071 */ 00072 00073 /* 00074 * The base thread functionality of Shore Threads is derived 00075 * from the NewThreads implementation wrapped up as c++ objects. 00076 */ 00077 00078 #include <w.h> 00079 00080 #include <w_debug.h> 00081 #include <w_stream.h> 00082 #include <cstdlib> 00083 #include <sched.h> 00084 #include <cstring> 00085 00086 #ifdef __SUNPRO_CC 00087 #include <sys/time.h> 00088 #else 00089 #include <ctime> 00090 #endif 00091 00092 #include <sys/wait.h> 00093 #include <new> 00094 00095 #include <sys/stat.h> 00096 #include <w_rusage.h> 00097 #include "tls.h" 00098 00099 #ifdef __GNUC__ 00100 #pragma implementation "sthread.h" 00101 #endif 00102 00103 #include "sthread.h" 00104 #include "rand48.h" 00105 #include "sthread_stats.h" 00106 #include "stcore_pthread.h" 00107