![]() ![]() |
![]() |
1 mday 1.1.2.1 //%///////////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM 4 // 5 // Permission is hereby granted, free of charge, to any person obtaining a copy 6 // of this software and associated documentation files (the "Software"), to 7 // deal in the Software without restriction, including without limitation the 8 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9 // sell copies of the Software, and to permit persons to whom the Software is 10 // furnished to do so, subject to the following conditions: 11 // 12 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 13 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED 14 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 15 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 16 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 17 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 18 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 19 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 // 21 //============================================================================== 22 mday 1.1.2.1 // | ||
23 mday 1.1.2.2 // Author: Mike Day (mdday@us.ibm.com) | ||
24 mday 1.1.2.1 // | ||
25 mday 1.1.2.2 // Modified By: | ||
26 mday 1.1.2.1 // 27 //%///////////////////////////////////////////////////////////////////////////// 28 29 #include "Thread.h" | ||
30 mday 1.1.2.4 #include <Pegasus/Common/IPC.h> | ||
31 mday 1.1.2.1 32 #if defined(PEGASUS_OS_TYPE_WINDOWS) 33 # include "ThreadWindows.cpp" 34 #elif defined(PEGASUS_OS_TYPE_UNIX) 35 # include "ThreadUnix.cpp" 36 #else 37 # error "Unsupported platform" 38 #endif 39 40 PEGASUS_NAMESPACE_BEGIN 41 | ||
42 mday 1.1.2.8 void thread_data::default_delete(void * data) 43 { 44 if( data != NULL) 45 ::operator delete(data); 46 } 47 48 | ||
49 mday 1.1.2.3 Boolean Thread::_signals_blocked = false; | ||
50 mday 1.1.2.1 51 // for non-native implementations 52 #ifndef PEGASUS_THREAD_CLEANUP_NATIVE 53 void Thread::cleanup_push( void (*routine)(void *), void *parm) throw(IPCException) 54 { | ||
55 mday 1.1.2.5 cleanup_handler *cu = new cleanup_handler(routine, parm); 56 try 57 { 58 _cleanup.insert_first(cu); 59 } 60 catch(IPCException& e) 61 { | ||
62 mday 1.1.2.7 e = e; 63 delete cu; | ||
64 mday 1.1.2.5 throw; 65 } 66 return; | ||
67 mday 1.1.2.1 } | ||
68 mday 1.1.2.5 | ||
69 kumpf 1.1.2.6 void Thread::cleanup_pop(Boolean execute) throw(IPCException) | ||
70 mday 1.1.2.1 { | ||
71 mday 1.1.2.5 cleanup_handler *cu ; 72 try 73 { 74 cu = _cleanup.remove_first() ; 75 } 76 catch(IPCException& e) | ||
77 mday 1.1.2.7 { 78 e = e; | ||
79 kumpf 1.1.2.6 PEGASUS_ASSERT(0); | ||
80 mday 1.1.2.5 } 81 if(execute == true) 82 cu->execute(); 83 delete cu; | ||
84 mday 1.1.2.1 } | ||
85 mday 1.1.2.5 | ||
86 mday 1.1.2.3 #endif | ||
87 mday 1.1.2.4 88 89 //thread_data *Thread::put_tsd(Sint8 *key, void (*delete_func)(void *), Uint32 size, void *value) throw(IPCException) 90 | ||
91 mday 1.1.2.2 | ||
92 mday 1.1.2.3 #ifndef PEGASUS_THREAD_EXIT_NATIVE | ||
93 mday 1.1.2.2 void Thread::exit_self(PEGASUS_THREAD_RETURN exit_code) 94 { | ||
95 mday 1.1.2.5 // execute the cleanup stack and then return 96 while( _cleanup.count() ) 97 { 98 try 99 { 100 cleanup_pop(true); 101 } 102 catch(IPCException& e) 103 { | ||
104 mday 1.1.2.7 e = e; 105 PEGASUS_ASSERT(0); 106 break; | ||
107 mday 1.1.2.5 } 108 } | ||
109 mday 1.1.2.7 _exit_code = exit_code; 110 exit_thread(exit_code); | ||
111 mday 1.1.2.2 } | ||
112 mday 1.1.2.4 | ||
113 mday 1.1.2.7 | ||
114 mday 1.1.2.1 #endif 115 116 PEGASUS_NAMESPACE_END | ||
117 mday 1.1.2.7 |
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |