comparison packages/kernel/current/src/common/kapi.cxx @ 8:ece80412419a ecos-sw-1999-05-21

Merge from eCos master repository on 1999-05-21-22:05:54-BST
author jlarmour
date Fri, 21 May 1999 15:09:30 +0000
parents 1d7f19c9e4d1
children d3fbcdfa1b2f
comparison
equal deleted inserted replaced
7:e55593b6dcea 8:ece80412419a
149 externC void cyg_thread_exit() 149 externC void cyg_thread_exit()
150 { 150 {
151 Cyg_Thread::exit(); 151 Cyg_Thread::exit();
152 } 152 }
153 153
154 externC void cyg_thread_delete( cyg_handle_t thread ) 154 externC cyg_bool_t cyg_thread_delete( cyg_handle_t thread )
155 { 155 {
156 Cyg_Thread *th = (Cyg_Thread *)thread; 156 Cyg_Thread *th = (Cyg_Thread *)thread;
157 if( th->get_state() != Cyg_Thread::EXITED ) 157 if( th->get_state() != Cyg_Thread::EXITED )
158 th->kill(); 158 th->kill(); // encourage it to terminate
159 th->~Cyg_Thread(); 159 if( th->get_state() != Cyg_Thread::EXITED )
160 return false; // it didn't run yet, leave it up to the app to fix
161 th->~Cyg_Thread();
162 return true;
160 } 163 }
161 164
162 externC void cyg_thread_suspend(cyg_handle_t thread) 165 externC void cyg_thread_suspend(cyg_handle_t thread)
163 { 166 {
164 ((Cyg_Thread *)thread)->suspend(); 167 ((Cyg_Thread *)thread)->suspend();
177 th->resume(); 180 th->resume();
178 } 181 }
179 182
180 externC void cyg_thread_kill( cyg_handle_t thread) 183 externC void cyg_thread_kill( cyg_handle_t thread)
181 { 184 {
182 ((Cyg_Thread *)thread)->kill(); 185 ((Cyg_Thread *)thread)->kill();
183 } 186 }
184 187
185 externC void cyg_thread_release( cyg_handle_t thread) 188 externC void cyg_thread_release( cyg_handle_t thread)
186 { 189 {
187 ((Cyg_Thread *)thread)->release(); 190 ((Cyg_Thread *)thread)->release();
199 202
200 /* Priority manipulation */ 203 /* Priority manipulation */
201 externC void cyg_thread_set_priority( 204 externC void cyg_thread_set_priority(
202 cyg_handle_t thread, cyg_priority_t priority ) 205 cyg_handle_t thread, cyg_priority_t priority )
203 { 206 {
207 #ifdef CYGIMP_THREAD_PRIORITY
204 ((Cyg_Thread *)thread)->set_priority(priority); 208 ((Cyg_Thread *)thread)->set_priority(priority);
209 #endif
205 } 210 }
206 211
207 externC cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread) 212 externC cyg_priority_t cyg_thread_get_priority(cyg_handle_t thread)
208 { 213 {
214 #ifdef CYGIMP_THREAD_PRIORITY
209 return ((Cyg_Thread *)thread)->get_priority(); 215 return ((Cyg_Thread *)thread)->get_priority();
216 #else
217 return 0;
218 #endif
210 } 219 }
211 220
212 /* Deadline scheduling control (optional) */ 221 /* Deadline scheduling control (optional) */
213 222
214 externC void cyg_thread_deadline_wait( 223 externC void cyg_thread_deadline_wait(