Mercurial > flash_v2
annotate packages/kernel/current/include/thread.hxx @ 124:0ec04793409a ecos-sw-2000-09-11
Merge from eCos master repository on 2000-09-11-03:00:13-BST
| author | jlarmour |
|---|---|
| date | Mon, 11 Sep 2000 02:42:46 +0000 |
| parents | bf00f99aec69 |
| children | 6b5f480c6929 |
| rev | line source |
|---|---|
| 0 | 1 #ifndef CYGONCE_KERNEL_THREAD_HXX |
| 2 #define CYGONCE_KERNEL_THREAD_HXX | |
| 3 | |
| 4 //========================================================================== | |
| 5 // | |
| 2 | 6 // thread.hxx |
| 0 | 7 // |
| 2 | 8 // Thread class declarations |
| 0 | 9 // |
| 10 //========================================================================== | |
| 11 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
12 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
13 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
14 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
15 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
16 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
17 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
18 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
19 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
21 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
22 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
24 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
25 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
26 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
27 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
28 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
29 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
30 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
31 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
32 // |
| 0 | 33 //####COPYRIGHTEND#### |
| 34 //========================================================================== | |
| 35 //#####DESCRIPTIONBEGIN#### | |
| 36 // | |
| 2 | 37 // Author(s): nickg |
| 38 // Contributors: nickg | |
| 39 // Date: 1997-09-09 | |
| 40 // Purpose: Define Thread class interfaces | |
| 41 // Description: The classes defined here collectively implement the | |
| 0 | 42 // internal API used to create, configure and manage threads. |
| 2 | 43 // Usage: #include <cyg/kernel/thread.hxx> |
| 0 | 44 // |
| 45 //####DESCRIPTIONEND#### | |
| 46 // | |
| 47 //========================================================================== | |
| 48 | |
| 49 #include <cyg/kernel/ktypes.h> | |
| 50 #include <cyg/infra/cyg_ass.h> // assertion macros | |
| 51 #include <cyg/kernel/sched.hxx> | |
| 52 #include <cyg/kernel/clock.hxx> | |
| 53 #include <cyg/kernel/except.hxx> | |
| 54 | |
| 55 #include <cyg/hal/hal_arch.h> | |
| 56 | |
| 57 // ------------------------------------------------------------------------- | |
| 58 // Miscellaneous types | |
| 59 | |
| 60 typedef void cyg_thread_entry(CYG_ADDRWORD data);// Thread entry point function | |
| 61 | |
| 62 // ------------------------------------------------------------------------- | |
| 63 // Hardware thread interface. | |
| 64 // The implementation of this class is provided by the HAL. | |
| 65 | |
| 66 class Cyg_HardwareThread | |
| 67 { | |
| 68 friend class Cyg_Scheduler; | |
| 69 | |
| 70 protected: | |
| 71 | |
| 72 CYG_ADDRESS stack_base; // pointer to base of stack area | |
| 73 | |
| 74 cyg_uint32 stack_size; // size of stack area in bytes | |
| 75 | |
| 76 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT | |
| 77 CYG_ADDRESS stack_limit; // movable stack limit | |
| 78 #endif | |
| 79 | |
| 80 CYG_ADDRESS stack_ptr; // pointer to saved state on stack | |
| 81 | |
| 82 cyg_thread_entry *entry_point; // main entry point (code pointer!) | |
| 83 | |
| 84 CYG_ADDRWORD entry_data; // entry point argument | |
| 85 | |
| 86 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT | |
| 87 | |
| 88 HAL_SavedRegisters *saved_context; // If non-zero, this points at a more | |
| 89 // interesting context than stack_ptr. | |
| 90 #endif | |
| 91 | |
| 92 Cyg_HardwareThread( | |
| 93 cyg_thread_entry *entry_point, // entry point function | |
| 94 CYG_ADDRWORD entry_data, // entry data | |
| 95 cyg_ucount32 stack_size = 0, // stack size, 0 = use default | |
| 96 CYG_ADDRESS stack_base = 0 // stack base, NULL = allocate | |
| 97 ); | |
| 98 | |
| 99 // Thread entry point. This is where all threads begin execution. | |
| 100 // This routine does a little housekeeping and then call the main | |
| 101 // entry_point specified above. | |
| 102 static void thread_entry(Cyg_Thread *thread); | |
| 103 | |
| 104 // Initialize the context of the thread to start execution at thread_entry | |
| 105 void init_context( Cyg_Thread *thread ); | |
| 106 | |
| 107 // Save current thread's context and load that of the given next thread. | |
| 108 void switch_context(Cyg_HardwareThread *next); | |
| 109 | |
| 110 // load this thread's context without saving current context | |
| 111 void load_context(); | |
| 112 | |
| 113 // attach a stack to this thread | |
| 114 void attach_stack(CYG_ADDRESS stack, cyg_uint32 stack_size); | |
| 115 | |
| 116 // detach the stack from this thread | |
| 117 CYG_ADDRESS detach_stack(); | |
| 118 | |
| 119 // Adjust the thread's saved state to call the exception | |
| 120 // handler when next executed. | |
| 121 void prepare_exception ( | |
| 122 cyg_exception_handler *exception_handler, | |
| 123 CYG_ADDRWORD exception_data, | |
| 124 cyg_code exception_number, | |
| 125 CYG_ADDRWORD exception_info | |
| 126 ); | |
| 127 | |
| 128 public: | |
| 129 | |
| 130 CYGDBG_DEFINE_CHECK_THIS | |
| 131 | |
| 132 // Get and set entry_data. | |
| 133 | |
| 134 void set_entry_data( CYG_ADDRWORD data ); | |
| 135 | |
| 136 CYG_ADDRWORD get_entry_data(); | |
| 137 | |
| 138 #ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT | |
| 139 // Return the current saved state for this thread. | |
| 140 HAL_SavedRegisters *get_saved_context(); | |
| 141 | |
| 142 // Set the saved context pointer. | |
| 143 void set_saved_context(HAL_SavedRegisters *ctx); | |
| 144 #endif | |
| 145 | |
| 146 // get the size/base of this thread's stack | |
| 147 CYG_ADDRESS get_stack_base(); | |
| 148 | |
| 149 cyg_uint32 get_stack_size(); | |
| 150 | |
| 151 #ifdef CYGFUN_KERNEL_THREADS_STACK_LIMIT | |
| 152 // Allocate some memory at the lower end of the stack | |
| 153 // by moving the stack limit pointer. | |
| 154 | |
| 155 void *increment_stack_limit( cyg_ucount32 size); | |
| 156 | |
| 157 CYG_ADDRESS get_stack_limit(); | |
| 158 #endif | |
| 159 }; | |
| 160 | |
| 161 // ------------------------------------------------------------------------- | |
| 162 // Per-thread timer support class. | |
| 163 // This is only included when required. | |
| 164 | |
| 165 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 166 | |
| 167 class Cyg_ThreadTimer | |
| 168 : public Cyg_Alarm | |
| 169 { | |
| 170 friend class Cyg_Thread; | |
| 171 | |
| 172 // Pointer to current thread | |
| 173 Cyg_Thread *thread; | |
| 174 | |
| 175 // Constructor | |
| 176 Cyg_ThreadTimer( | |
| 177 Cyg_Thread *thread | |
| 178 ); | |
| 179 | |
| 180 // Alarm function | |
| 181 static void alarm( Cyg_Alarm *alarm, CYG_ADDRWORD data); | |
| 182 | |
| 183 CYGDBG_DEFINE_CHECK_THIS | |
| 184 | |
| 185 }; | |
| 186 | |
| 187 #endif | |
| 188 | |
| 189 // ------------------------------------------------------------------------- | |
| 190 // Main Thread class. | |
| 191 // This provides the public API for controlling threads. | |
| 192 | |
| 193 class Cyg_Thread | |
| 194 : public Cyg_HardwareThread, // provides hardware abstractions | |
| 195 public Cyg_SchedThread // provides scheduling abstractions | |
| 196 { | |
| 197 friend class Cyg_Scheduler; | |
| 198 friend void deliver_exception( CYG_WORD code, CYG_ADDRWORD data ); | |
| 199 | |
| 200 // The following definitions are used by all variants of the | |
| 201 // basic thread object. | |
| 202 | |
| 203 public: | |
| 204 enum { // Thread state values | |
| 205 | |
| 206 RUNNING = 0, // Thread is runnable or running | |
| 207 SLEEPING = 1, // Thread is waiting for something to happen | |
| 2 | 208 COUNTSLEEP = 2, // Sleep in counted manner |
| 0 | 209 SUSPENDED = 4, // Suspend count is non-zero |
| 210 CREATING = 8, // Thread is being created | |
| 211 EXITED = 16, // Thread has exited | |
| 212 | |
| 213 // This is the set of bits that must be cleared by a generic | |
| 214 // wake() or release(). | |
| 215 SLEEPSET = (SLEEPING | COUNTSLEEP) | |
| 216 }; | |
| 217 | |
| 218 private: | |
| 219 // Current thread state, a logical OR of the above values. | |
| 220 // Only if this word is zero can the thread execute. | |
| 221 cyg_uint32 state; | |
| 222 | |
| 223 // Suspension counter, if > 0, the thread is suspended | |
| 224 cyg_ucount32 suspend_count; | |
| 225 | |
| 226 // Wakeup counter, if > 0, sleep will not sleep, just decrement | |
| 227 cyg_ucount32 wakeup_count; | |
| 228 | |
| 229 // A word of data used in syncronization object to communicate | |
| 230 // information between sleepers and wakers. | |
| 231 CYG_ADDRWORD wait_info; | |
| 232 | |
| 233 // Unique thread id assigned on creation | |
| 234 cyg_uint16 unique_id; | |
| 235 | |
| 236 #ifdef CYGPKG_KERNEL_EXCEPTIONS | |
| 237 | |
| 238 // If exceptions are supported, define an exception control | |
| 239 // object that will be used to manage and deliver them. If | |
| 240 // exceptions are global there is a single static instance | |
| 241 // of this object, if they are per-thread then there is one | |
| 242 // for each thread. | |
| 243 private: | |
| 244 | |
| 245 #ifdef CYGSEM_KERNEL_EXCEPTIONS_GLOBAL | |
| 246 static | |
| 247 #endif | |
| 248 Cyg_Exception_Control exception_control; | |
| 249 | |
| 250 public: | |
| 251 | |
| 252 static void register_exception( | |
| 253 cyg_code exception_number, // exception number | |
| 254 cyg_exception_handler handler, // handler function | |
| 255 CYG_ADDRWORD data, // data argument | |
| 256 cyg_exception_handler **old_handler, // handler function | |
| 257 CYG_ADDRWORD *old_data // data argument | |
| 258 ); | |
| 259 | |
| 260 static void deregister_exception( | |
| 261 cyg_code exception_number // exception number | |
| 262 ); | |
| 263 | |
| 264 void deliver_exception( | |
| 265 cyg_code exception_number, // exception being raised | |
| 266 CYG_ADDRWORD exception_info // exception specific info | |
| 267 ); | |
| 268 | |
| 269 #endif | |
| 270 | |
| 271 | |
| 272 public: | |
| 273 | |
| 274 CYGDBG_DEFINE_CHECK_THIS | |
| 275 | |
| 276 // Constructor, Initialize the thread structure. The thread is | |
| 277 // created in suspended state, and needs to be resumed to execute. | |
| 278 // It is also started at some (configurable) default priority, which | |
| 279 // may need to be changed before calling resume. | |
| 280 | |
| 281 Cyg_Thread ( | |
| 282 cyg_thread_entry *entry, // entry point function | |
| 283 CYG_ADDRWORD entry_data, // entry data | |
| 284 cyg_ucount32 stack_size = 0, // stack size, 0 = use default | |
| 285 CYG_ADDRESS stack_base = 0 // stack base, NULL = allocate | |
| 286 ); | |
| 287 | |
| 288 Cyg_Thread ( | |
| 289 CYG_ADDRWORD sched_info, // Scheduling parameter(s) | |
| 290 cyg_thread_entry *entry, // entry point function | |
| 291 CYG_ADDRWORD entry_data, // entry data | |
| 292 char *name, // thread name | |
| 293 CYG_ADDRESS stack_base = 0, // stack base, NULL = allocate | |
| 294 cyg_ucount32 stack_size = 0 // stack size, 0 = use default | |
| 295 ); | |
| 296 | |
| 297 // Re-initialize the thread back to it's initial state. | |
| 298 void Cyg_Thread::reinitialize(); | |
| 299 | |
| 300 ~Cyg_Thread(); | |
| 301 | |
| 302 // The following are invoked implicitly on the current thread, | |
| 303 // hence they are static member functions. | |
| 304 | |
| 305 static void sleep(); // Put thread to sleep | |
| 306 | |
| 307 static void counted_sleep();// Decrement counter or put | |
| 308 // thread to sleep | |
| 309 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 310 static void counted_sleep( cyg_tick_count delay ); | |
| 311 // ...for delay ticks | |
| 312 #endif | |
| 313 | |
| 314 static void exit(); // Terminate thread | |
| 315 | |
| 316 static void yield(); // Yield CPU to another thread | |
| 317 | |
| 2 | 318 static void rotate_queue( cyg_priority pri ); |
| 0 | 319 // Rotate that run queue |
| 2 | 320 |
| 321 void to_queue_head( void ); | |
| 322 // Move to the head of its queue | |
| 323 // (not necessarily a scheduler q) | |
| 0 | 324 |
| 325 static Cyg_Thread *self(); // Return current thread | |
| 326 | |
| 327 | |
| 328 // The following are called on threads other than the current one. | |
| 329 | |
| 330 void wake(); // Wake this thread from sleep. | |
| 331 | |
| 332 void counted_wake(); // Increment counter or wake thread | |
| 333 cyg_uint32 cancel_counted_wake(); | |
| 334 // Cancel counted wakeups for this | |
| 335 // thread and return how many were | |
| 336 // pending | |
| 337 | |
| 338 void suspend(); // Suspend this thread: increment counter and | |
| 339 // deschedule. | |
| 340 | |
| 341 void resume(); // Resume this thread: decrement counter and | |
| 342 // reschedule if counter is zero. | |
| 343 | |
| 344 void release(); // Release thread from sleep with BREAK | |
| 345 // wake_reason. | |
| 346 | |
| 347 void kill(); // Kill this thread | |
| 348 | |
| 349 void force_resume(); // Resume this thread: set counter to zero. | |
| 350 | |
| 351 cyg_uint32 get_state(); // Return current thread state. | |
| 352 | |
| 353 | |
| 354 // Accessor functions to set and get wait_info. | |
| 355 | |
| 356 void set_wait_info(CYG_ADDRWORD data); | |
| 357 | |
| 358 CYG_ADDRWORD get_wait_info(); | |
| 359 | |
| 360 // This part of the API is used if we have a clock and want | |
| 361 // per-thread timers for doing delays and timeouts. | |
| 362 | |
| 363 // delay the given number of ticks | |
| 364 void delay( cyg_tick_count delay ); | |
| 365 | |
| 366 | |
| 367 enum cyg_reason // sleep/wakeup reason codes | |
| 368 { | |
| 369 NONE, // No recorded reason | |
| 370 WAIT, // Wait with no timeout | |
| 371 DELAY, // Simple time delay | |
| 372 TIMEOUT, // Wait with timeout/timeout expired | |
| 373 BREAK, // forced break out of sleep | |
| 374 DESTRUCT, // wait object destroyed[note] | |
| 375 EXIT, // forced termination | |
| 376 DONE // Wait/delay complete | |
| 377 }; | |
| 378 // [note] NOT the thread, some object it was waiting on. | |
| 379 // Thread destruction would first involve EXITing it. | |
| 380 | |
| 381 private: | |
| 382 | |
| 383 #ifdef CYGFUN_KERNEL_THREADS_TIMER | |
| 384 Cyg_ThreadTimer timer; // per-thread timer | |
| 385 #endif | |
| 386 | |
| 387 cyg_reason sleep_reason; // reason for sleeping | |
| 388 | |
| 389 cyg_reason wake_reason; // reason for waking | |
| 390 | |
| 391 #ifdef CYGIMP_THREAD_PRIORITY | |
| 392 | |
| 393 public: | |
| 394 | |
| 395 // If the scheduler implements priorities, provide | |
| 396 // functions to set and get it. | |
| 397 | |
| 398 void set_priority( cyg_priority pri ); | |
| 399 | |
| 400 cyg_priority get_priority(); | |
| 401 | |
| 402 // This returns the current dispatching priority of the | |
| 403 // thread. This may differ from the result of get_priority() | |
| 404 // in the presence of priority inheritance or certain | |
| 405 // scheduling algorithms. | |
| 406 cyg_priority get_current_priority(); | |
| 407 | |
| 408 #endif | |
| 409 | |
| 410 #ifdef CYGVAR_KERNEL_THREADS_DATA | |
| 411 | |
| 412 private: | |
| 413 // Array of single word entries for each index. | |
| 414 CYG_ADDRWORD thread_data[CYGNUM_KERNEL_THREADS_DATA_MAX]; | |
| 415 | |
| 416 // Map of free thread_data indexes. Each bit represents an index | |
| 417 // and is 1 if that index is free, and 0 if it is in use. | |
| 418 static cyg_ucount32 thread_data_map; | |
| 419 | |
| 420 public: | |
| 421 | |
| 422 static CYG_ADDRWORD get_data( cyg_ucount32 index ); | |
| 423 | |
| 424 static CYG_ADDRWORD *get_data_ptr( cyg_ucount32 index ); | |
| 425 | |
| 426 void set_data( cyg_ucount32 index, CYG_ADDRWORD data ); | |
| 427 | |
| 428 static cyg_ucount32 new_data_index(); | |
| 429 | |
| 430 static void free_data_index( cyg_ucount32 index ); | |
| 431 | |
| 432 #endif | |
| 433 | |
| 434 #ifdef CYGVAR_KERNEL_THREADS_NAME | |
| 435 | |
| 436 private: | |
| 437 // An optional thread name string, for humans to read | |
| 438 char *name; | |
| 439 | |
| 440 public: | |
| 441 // function to get the name string | |
| 442 char *get_name(); | |
| 443 | |
| 444 #endif | |
| 445 | |
| 446 | |
| 447 #ifdef CYGVAR_KERNEL_THREADS_LIST | |
| 448 | |
| 449 // Housekeeping list that tracks all threads | |
| 450 private: | |
| 451 Cyg_Thread *list_next; | |
| 452 static Cyg_Thread *thread_list; | |
| 453 | |
| 454 void add_to_list( void ); | |
| 455 void remove_from_list( void ); | |
| 456 public: | |
| 457 | |
| 458 static Cyg_Thread *get_list_head(); | |
| 459 | |
| 460 Cyg_Thread *get_list_next(); | |
| 461 | |
| 462 #endif | |
| 463 | |
| 464 public: | |
| 465 | |
| 466 // Set sleep reason to reason and wake reason to NONE | |
| 467 static void set_sleep_reason( cyg_reason reason = WAIT); | |
| 468 | |
| 469 cyg_reason get_sleep_reason(); | |
| 470 | |
| 471 // Set the wakeup reason to the given value | |
| 472 void set_wake_reason( cyg_reason reason = DONE); | |
| 473 | |
| 474 // Get current wake reason | |
| 475 cyg_reason get_wake_reason(); | |
| 476 | |
| 477 static void set_timer( // Set timeout and sleep reason | |
| 478 cyg_tick_count trigger, // Absolute wakeup time | |
| 479 cyg_reason sleep_reason // reason for sleeping | |
| 480 ); | |
| 481 | |
| 482 static void clear_timer(); // disable thread timer | |
| 483 | |
| 484 // Get a 16 bit unique id for this thread. This is | |
| 485 // used in tracing and instrumentation to identify the | |
| 486 // current thread. | |
| 487 | |
| 488 cyg_uint16 get_unique_id(); | |
| 489 | |
| 490 }; | |
| 491 | |
| 492 // ------------------------------------------------------------------------- | |
| 493 // Thread Queue class. | |
| 494 // This defines the main API for manipulating queues of threads. | |
| 495 | |
| 496 class Cyg_ThreadQueue | |
| 2 | 497 : public Cyg_ThreadQueue_Implementation |
| 0 | 498 { |
| 499 | |
| 500 public: | |
| 501 | |
| 502 CYGDBG_DEFINE_CHECK_THIS | |
| 503 | |
| 504 // API used by rest of kernel. | |
| 505 | |
| 506 // Add thread to queue | |
| 507 void enqueue(Cyg_Thread *thread); | |
| 508 | |
| 509 // return first thread on queue | |
| 510 Cyg_Thread *highpri(); | |
| 511 | |
| 512 // remove first thread on queue | |
| 513 Cyg_Thread *dequeue(); | |
| 514 | |
| 515 // remove specified thread from queue | |
| 516 void remove(Cyg_Thread *thread); | |
| 517 | |
| 518 // test if queue is empty | |
| 519 cyg_bool empty(); | |
| 520 | |
| 521 }; | |
| 522 | |
| 523 // ------------------------------------------------------------------------- | |
| 524 // Thread inlines | |
| 525 | |
| 526 // Return current thread state. | |
| 527 inline cyg_uint32 Cyg_Thread::get_state() | |
| 528 { | |
| 529 return state; | |
| 530 } | |
| 531 | |
| 532 inline void Cyg_Thread::set_wait_info(CYG_ADDRWORD data) | |
| 533 { | |
| 534 wait_info = data; | |
| 535 } | |
| 536 | |
| 537 inline CYG_ADDRWORD Cyg_Thread::get_wait_info() | |
| 538 { | |
| 539 return wait_info; | |
| 540 } | |
| 541 | |
| 542 // ------------------------------------------------------------------------- | |
| 543 #endif // ifndef CYGONCE_KERNEL_THREAD_HXX | |
| 544 // EOF thread.hxx |
