Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ThreadStartPlain.C

Go to the documentation of this file.
00001 // Copyright (C) 2001, Compaq Computer Corporation
00002 
00003 // This file is part of Vesta.
00004 
00005 // Vesta is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 
00010 // Vesta is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with Vesta; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019 // Last modified on Sun May 22 21:35:07 EDT 2005 by ken@xorian.net
00020 //      modified on Fri Jul 27 18:09:21 PDT 2001 by mann  
00021 //      modified on Mon Feb  5 16:00:04 EDT 2001 by schalk
00022 //      modified on Wed Dec 13 11:01:05 PST 2000 by yuanyu
00023 //      modified on Fri Aug 28 09:08:49 PDT 1998 by heydon
00024 
00025 // This version of the "ThreadStart" interface can be used wither
00026 // without garbage collection or with the Boehm garbage collector.
00027 
00028 // (Actually, what needs to be done to make the garbage collector to
00029 // work correctly differs from platform to platform.  Using GNU ld,
00030 // calls to pthread_create get re-directed to a wrapper provided by
00031 // the collector, so we don't need to do anything at thread startup
00032 // time.)
00033 
00034 #include <signal.h>
00035 
00036 #include "Basics.H"
00037 #include "ThreadStart.H"
00038 
00039 void *Basics::ThreadStart_Callback(void *arg) throw ()
00040 {
00041     // save arguments locally
00042     ForkArgs &forkArgs = *(ForkArgs *)arg;
00043 
00044     // set up signal handlers
00045     signal(SIGPIPE, SIG_IGN);
00046     signal(SIGQUIT, SIG_DFL);
00047     signal(SIGABRT, SIG_DFL);
00048     signal(SIGSEGV, SIG_DFL);
00049     signal(SIGILL,  SIG_DFL);
00050     signal(SIGBUS,  SIG_DFL);
00051 
00052 #if defined(__linux__) && defined(GPROF_SUPPORT)
00053     // gprof support (see comment in ThreadStart.H)
00054     setitimer(ITIMER_PROF, &(forkArgs.itimer), NULL);
00055 #endif
00056 
00057     // invoke the real procedure
00058     void *res = (*(forkArgs.proc))(forkArgs.arg);
00059     delete (ForkArgs *)arg;
00060     return res;
00061 }
00062 
00063 void Basics::ThreadStart_WaitForChild(ForkArgs *forkArgs) throw ()
00064 {
00065     // We only need to wait when running with the DECwest garbage
00066     // collector (in which case we won't be using this source file).
00067 }

Generated on Mon May 8 00:48:29 2006 for Vesta by  doxygen 1.4.2