RTEMS
threadimpl.h
Go to the documentation of this file.
1 
12 /*
13  * COPYRIGHT (c) 1989-2008.
14  * On-Line Applications Research Corporation (OAR).
15  *
16  * Copyright (c) 2014, 2017 embedded brains GmbH.
17  *
18  * The license and distribution terms for this file may be
19  * found in the file LICENSE in this distribution or at
20  * http://www.rtems.org/license/LICENSE.
21  */
22 
23 #ifndef _RTEMS_SCORE_THREADIMPL_H
24 #define _RTEMS_SCORE_THREADIMPL_H
25 
26 #include <rtems/score/thread.h>
27 #include <rtems/score/assert.h>
28 #include <rtems/score/chainimpl.h>
29 #include <rtems/score/interr.h>
30 #include <rtems/score/isr.h>
31 #include <rtems/score/objectimpl.h>
33 #include <rtems/score/statesimpl.h>
34 #include <rtems/score/status.h>
35 #include <rtems/score/sysstate.h>
38 #include <rtems/score/todimpl.h>
40 #include <rtems/config.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
55 extern void *rtems_ada_self;
56 
66 
71 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
72 extern Thread_Control *_Thread_Allocated_fp;
73 #endif
74 
75 #if defined(RTEMS_SMP)
76 #define THREAD_OF_SCHEDULER_HELP_NODE( node ) \
77  RTEMS_CONTAINER_OF( node, Thread_Control, Scheduler.Help_node )
78 #endif
79 
80 typedef bool ( *Thread_Visitor )( Thread_Control *the_thread, void *arg );
81 
90 void _Thread_Iterate(
91  Thread_Visitor visitor,
92  void *arg
93 );
94 
101 
108 
116 void _Thread_Create_idle(void);
117 
126 
130 typedef struct {
135 
139  void *stack_area;
140 
144  size_t stack_size;
145 
151  void ( *stack_free )( void * );
152 
157 
162 
167 
172 
176  uint32_t isr_level;
177 
181  bool is_fp;
182 
188 
209 bool _Thread_Initialize(
210  Thread_Information *information,
211  Thread_Control *the_thread,
212  const Thread_Configuration *config
213 );
214 
249 bool _Thread_Start(
250  Thread_Control *the_thread,
251  const Thread_Entry_information *entry,
252  ISR_lock_Context *lock_context
253 );
254 
263  Thread_Control *executing,
264  const Thread_Entry_information *entry,
265  ISR_lock_Context *lock_context
267 
279  Thread_Control *the_thread,
280  const Thread_Entry_information *entry,
281  ISR_lock_Context *lock_context
282 );
283 
289 void _Thread_Yield( Thread_Control *executing );
290 
301  Thread_Life_state clear,
302  Thread_Life_state set,
303  Thread_Life_state ignore
304 );
305 
317 
327 void _Thread_Kill_zombies( void );
328 
336 void _Thread_Exit(
337  Thread_Control *executing,
338  Thread_Life_state set,
339  void *exit_value
340 );
341 
351 void _Thread_Join(
352  Thread_Control *the_thread,
353  States_Control waiting_for_join,
354  Thread_Control *executing,
355  Thread_queue_Context *queue_context
356 );
357 
365 void _Thread_Cancel(
366  Thread_Control *the_thread,
367  Thread_Control *executing,
368  void *exit_value
369 );
370 
371 typedef struct {
373  Thread_Control *cancel;
375 
387 void _Thread_Close(
388  Thread_Control *the_thread,
389  Thread_Control *executing,
390  Thread_Close_context *context
391 );
392 
402 {
403  return _States_Is_ready( the_thread->current_state );
404 }
405 
418  Thread_Control *the_thread,
419  States_Control state
420 );
421 
434  Thread_Control *the_thread,
435  States_Control state
436 );
437 
450  Thread_Control *the_thread,
451  States_Control state
452 );
453 
466  Thread_Control *the_thread,
467  States_Control state
468 );
469 
479  Thread_Control *the_thread
480 );
481 
487 void _Thread_Entry_adaptor_idle( Thread_Control *executing );
488 
495 
504 
520 void _Thread_Handler( void );
521 
529  Thread_Control *the_thread,
530  ISR_lock_Context *lock_context
531 )
532 {
533  _Thread_queue_Do_acquire_critical( &the_thread->Join_queue, lock_context );
534 }
535 
543  Thread_Control *the_thread,
544  ISR_lock_Context *lock_context
545 )
546 {
547  _ISR_lock_ISR_disable( lock_context );
548  _Thread_State_acquire_critical( the_thread, lock_context );
549 }
550 
560  ISR_lock_Context *lock_context
561 )
562 {
563  Thread_Control *executing;
564 
565  _ISR_lock_ISR_disable( lock_context );
566  executing = _Thread_Executing;
567  _Thread_State_acquire_critical( executing, lock_context );
568 
569  return executing;
570 }
571 
579  Thread_Control *the_thread,
580  ISR_lock_Context *lock_context
581 )
582 {
583  _Thread_queue_Do_release_critical( &the_thread->Join_queue, lock_context );
584 }
585 
593  Thread_Control *the_thread,
594  ISR_lock_Context *lock_context
595 )
596 {
597  _Thread_State_release_critical( the_thread, lock_context );
598  _ISR_lock_ISR_enable( lock_context );
599 }
600 
609 #if defined(RTEMS_DEBUG)
610 RTEMS_INLINE_ROUTINE bool _Thread_State_is_owner(
611  const Thread_Control *the_thread
612 )
613 {
614  return _Thread_queue_Is_lock_owner( &the_thread->Join_queue );
615 }
616 #endif
617 
631  Thread_Control *start_of_path,
632  Thread_queue_Context *queue_context
633 );
634 
651  Thread_Control *the_thread,
652  Priority_Node *priority_node,
653  Thread_queue_Context *queue_context
654 );
655 
672  Thread_Control *the_thread,
673  Priority_Node *priority_node,
674  Thread_queue_Context *queue_context
675 );
676 
696  Thread_Control *the_thread,
697  Priority_Node *priority_node,
698  bool prepend_it,
699  Thread_queue_Context *queue_context
700 );
701 
723  Thread_Control *the_thread,
724  Priority_Node *priority_node,
725  Priority_Control new_priority,
726  bool prepend_it,
727  Thread_queue_Context *queue_context
728 )
729 {
730  _Priority_Node_set_priority( priority_node, new_priority );
732  the_thread,
733  priority_node,
734  prepend_it,
735  queue_context
736  );
737 }
738 
752  Thread_Control *the_thread,
753  Priority_Node *victim_node,
754  Priority_Node *replacement_node
755 );
756 
768 void _Thread_Priority_update( Thread_queue_Context *queue_context );
769 
776 #if defined(RTEMS_SMP)
778  Thread_Control *the_thread,
779  int sticky_level_change
780 );
781 #endif
782 
794  Priority_Control left,
795  Priority_Control right
796 )
797 {
798  return left > right;
799 }
800 
811  Priority_Control left,
812  Priority_Control right
813 )
814 {
815  return _Thread_Priority_less_than( left, right ) ? right : left;
816 }
817 
827  Objects_Id id
828 )
829 {
830  uint32_t the_api;
831 
832  the_api = _Objects_Get_API( id );
833 
834  if ( !_Objects_Is_api_valid( the_api ) ) {
835  return NULL;
836  }
837 
838  /*
839  * Threads are always first class :)
840  *
841  * There is no need to validate the object class of the object identifier,
842  * since this will be done by the object get methods.
843  */
844  return _Objects_Information_table[ the_api ][ 1 ];
845 }
846 
856  Objects_Id id,
857  ISR_lock_Context *lock_context
858 );
859 
868  const Thread_Control *thread
869 )
870 {
871 #if defined(RTEMS_SMP)
872  return thread->Scheduler.cpu;
873 #else
874  (void) thread;
875 
876  return _Per_CPU_Get();
877 #endif
878 }
879 
887  Thread_Control *thread,
888  Per_CPU_Control *cpu
889 )
890 {
891 #if defined(RTEMS_SMP)
892  thread->Scheduler.cpu = cpu;
893 #else
894  (void) thread;
895  (void) cpu;
896 #endif
897 }
898 
911  const Thread_Control *the_thread
912 )
913 {
914  return ( the_thread == _Thread_Executing );
915 }
916 
917 #if defined(RTEMS_SMP)
918 
931  const Thread_Control *the_thread
932 )
933 {
934  return _CPU_Context_Get_is_executing( &the_thread->Registers );
935 }
936 #endif
937 
950  const Thread_Control *the_thread
951 )
952 {
953  return ( the_thread == _Thread_Heir );
954 }
955 
966  Thread_Control *the_thread
967 )
968 {
969  _Thread_Clear_state( the_thread, STATES_BLOCKED );
970 }
971 
987 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
988 RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp (
989  const Thread_Control *the_thread
990 )
991 {
992  return ( the_thread == _Thread_Allocated_fp );
993 }
994 #endif
995 
996 /*
997  * If the CPU has hardware floating point, then we must address saving
998  * and restoring it as part of the context switch.
999  *
1000  * The second conditional compilation section selects the algorithm used
1001  * to context switch between floating point tasks. The deferred algorithm
1002  * can be significantly better in a system with few floating point tasks
1003  * because it reduces the total number of save and restore FP context
1004  * operations. However, this algorithm can not be used on all CPUs due
1005  * to unpredictable use of FP registers by some compilers for integer
1006  * operations.
1007  */
1008 
1015 {
1016 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1017 #if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE )
1018  if ( executing->fp_context != NULL )
1019  _Context_Save_fp( &executing->fp_context );
1020 #endif
1021 #endif
1022 }
1023 
1030 {
1031 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1032 #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
1033  if ( (executing->fp_context != NULL) &&
1034  !_Thread_Is_allocated_fp( executing ) ) {
1035  if ( _Thread_Allocated_fp != NULL )
1036  _Context_Save_fp( &_Thread_Allocated_fp->fp_context );
1037  _Context_Restore_fp( &executing->fp_context );
1038  _Thread_Allocated_fp = executing;
1039  }
1040 #else
1041  if ( executing->fp_context != NULL )
1042  _Context_Restore_fp( &executing->fp_context );
1043 #endif
1044 #endif
1045 }
1046 
1053 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1054 RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void )
1055 {
1056  _Thread_Allocated_fp = NULL;
1057 }
1058 #endif
1059 
1070 {
1071  return ( _Thread_Dispatch_necessary );
1072 }
1073 
1083  const Thread_Control *the_thread
1084 )
1085 {
1086  return ( the_thread == NULL );
1087 }
1088 
1095 {
1096  /* Idle threads */
1097  uint32_t maximum_internal_threads =
1099 
1100  /* MPCI thread */
1101 #if defined(RTEMS_MULTIPROCESSING)
1102  if ( _System_state_Is_multiprocessing ) {
1103  ++maximum_internal_threads;
1104  }
1105 #endif
1106 
1107  return maximum_internal_threads;
1108 }
1109 
1117 {
1118  return (Thread_Control *)
1120 }
1121 
1136  Per_CPU_Control *cpu_self
1137 )
1138 {
1139  Thread_Control *heir;
1140 
1141  heir = cpu_self->heir;
1142  cpu_self->dispatch_necessary = false;
1143  cpu_self->executing = heir;
1144 
1145  return heir;
1146 }
1147 
1156  Thread_Control *the_thread,
1157  Per_CPU_Control *cpu
1158 )
1159 {
1160  Timestamp_Control last;
1161  Timestamp_Control ran;
1162 
1163  last = cpu->cpu_usage_timestamp;
1165  _Timestamp_Subtract( &last, &cpu->cpu_usage_timestamp, &ran );
1166  _Timestamp_Add_to( &the_thread->cpu_time_used, &ran );
1167 }
1168 
1176 #if defined( RTEMS_SMP )
1178  Per_CPU_Control *cpu_self,
1179  Per_CPU_Control *cpu_for_heir,
1180  Thread_Control *heir
1181 )
1182 {
1183  _Thread_Update_CPU_time_used( cpu_for_heir->heir, cpu_for_heir );
1184 
1185  cpu_for_heir->heir = heir;
1186 
1187  _Thread_Dispatch_request( cpu_self, cpu_for_heir );
1188 }
1189 #endif
1190 
1199  Thread_Control *the_thread,
1200  Timestamp_Control *cpu_time_used
1201 );
1202 
1209  Thread_Action_control *action_control
1210 )
1211 {
1212  _Chain_Initialize_empty( &action_control->Chain );
1213 }
1214 
1221  Thread_Action *action
1222 )
1223 {
1224  _Chain_Set_off_chain( &action->Node );
1225 }
1226 
1235  Thread_Control *the_thread,
1236  Thread_Action *action,
1237  Thread_Action_handler handler
1238 )
1239 {
1240  Per_CPU_Control *cpu_of_thread;
1241 
1242  _Assert( _Thread_State_is_owner( the_thread ) );
1243 
1244  cpu_of_thread = _Thread_Get_CPU( the_thread );
1245 
1246  action->handler = handler;
1247 
1248  _Thread_Dispatch_request( _Per_CPU_Get(), cpu_of_thread );
1249 
1251  &the_thread->Post_switch_actions.Chain,
1252  &action->Node
1253  );
1254 }
1255 
1265  Thread_Life_state life_state
1266 )
1267 {
1268  return ( life_state & THREAD_LIFE_RESTARTING ) != 0;
1269 }
1270 
1280  Thread_Life_state life_state
1281 )
1282 {
1283  return ( life_state & THREAD_LIFE_TERMINATING ) != 0;
1284 }
1285 
1295  Thread_Life_state life_state
1296 )
1297 {
1298  return ( life_state
1299  & ( THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED ) ) == 0;
1300 }
1301 
1311  Thread_Life_state life_state
1312 )
1313 {
1314  return ( life_state
1315  & ( THREAD_LIFE_RESTARTING | THREAD_LIFE_TERMINATING ) ) != 0;
1316 }
1317 
1327  const Thread_Control *the_thread
1328 )
1329 {
1330  _Assert( _Thread_State_is_owner( the_thread ) );
1331  return ( the_thread->Life.state & THREAD_LIFE_DETACHED ) == 0;
1332 }
1333 
1340  Thread_Control *the_thread
1341 )
1342 {
1343 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1344  ++the_thread->resource_count;
1345 #else
1346  (void) the_thread;
1347 #endif
1348 }
1349 
1356  Thread_Control *the_thread
1357 )
1358 {
1359 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1360  --the_thread->resource_count;
1361 #else
1362  (void) the_thread;
1363 #endif
1364 }
1365 
1366 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1367 
1378 RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources(
1379  const Thread_Control *the_thread
1380 )
1381 {
1382  return the_thread->resource_count != 0;
1383 }
1384 #endif
1385 
1386 #if defined(RTEMS_SMP)
1387 
1395  Thread_Control *the_thread,
1396  Per_CPU_Control *cpu
1397 )
1398 {
1399  ISR_lock_Context lock_context;
1400 
1401  _Per_CPU_Acquire( cpu, &lock_context );
1402 
1403  if ( !_Chain_Is_node_off_chain( &the_thread->Scheduler.Help_node ) ) {
1405  _Chain_Set_off_chain( &the_thread->Scheduler.Help_node );
1406  }
1407 
1408  _Per_CPU_Release( cpu, &lock_context );
1409 }
1410 #endif
1411 
1420  const Thread_Control *the_thread
1421 )
1422 {
1423 #if defined(RTEMS_SMP)
1424  return the_thread->Scheduler.home_scheduler;
1425 #else
1426  (void) the_thread;
1427  return &_Scheduler_Table[ 0 ];
1428 #endif
1429 }
1430 
1439  const Thread_Control *the_thread
1440 )
1441 {
1442 #if defined(RTEMS_SMP)
1443  _Assert( !_Chain_Is_empty( &the_thread->Scheduler.Wait_nodes ) );
1444  return SCHEDULER_NODE_OF_THREAD_WAIT_NODE(
1445  _Chain_First( &the_thread->Scheduler.Wait_nodes )
1446  );
1447 #else
1448  return the_thread->Scheduler.nodes;
1449 #endif
1450 }
1451 
1461  const Thread_Control *the_thread,
1462  size_t scheduler_index
1463 )
1464 {
1465 #if defined(RTEMS_SMP)
1466  return (Scheduler_Node *)
1467  ( (uintptr_t) the_thread->Scheduler.nodes
1468  + scheduler_index * _Scheduler_Node_size );
1469 #else
1470  _Assert( scheduler_index == 0 );
1471  (void) scheduler_index;
1472  return the_thread->Scheduler.nodes;
1473 #endif
1474 }
1475 
1476 #if defined(RTEMS_SMP)
1477 
1484  Thread_Control *the_thread,
1485  ISR_lock_Context *lock_context
1486 )
1487 {
1488  _ISR_lock_Acquire( &the_thread->Scheduler.Lock, lock_context );
1489 }
1490 
1498  Thread_Control *the_thread,
1499  ISR_lock_Context *lock_context
1500 )
1501 {
1502  _ISR_lock_Release( &the_thread->Scheduler.Lock, lock_context );
1503 }
1504 
1511 
1520  Thread_Control *the_thread,
1521  Scheduler_Node *scheduler_node,
1522  Scheduler_Node_request request
1523 )
1524 {
1525  ISR_lock_Context lock_context;
1526  Scheduler_Node_request current_request;
1527 
1528  _Thread_Scheduler_acquire_critical( the_thread, &lock_context );
1529 
1530  current_request = scheduler_node->Thread.request;
1531 
1532  if ( current_request == SCHEDULER_NODE_REQUEST_NOT_PENDING ) {
1533  _Assert(
1534  request == SCHEDULER_NODE_REQUEST_ADD
1535  || request == SCHEDULER_NODE_REQUEST_REMOVE
1536  );
1537  _Assert( scheduler_node->Thread.next_request == NULL );
1538  scheduler_node->Thread.next_request = the_thread->Scheduler.requests;
1539  the_thread->Scheduler.requests = scheduler_node;
1540  } else if ( current_request != SCHEDULER_NODE_REQUEST_NOTHING ) {
1541  _Assert(
1542  ( current_request == SCHEDULER_NODE_REQUEST_ADD
1543  && request == SCHEDULER_NODE_REQUEST_REMOVE )
1544  || ( current_request == SCHEDULER_NODE_REQUEST_REMOVE
1545  && request == SCHEDULER_NODE_REQUEST_ADD )
1546  );
1548  }
1549 
1550  scheduler_node->Thread.request = request;
1551 
1552  _Thread_Scheduler_release_critical( the_thread, &lock_context );
1553 }
1554 
1563  Thread_Control *the_thread,
1564  Scheduler_Node *scheduler_node
1565 )
1566 {
1568  &the_thread->Scheduler.Wait_nodes,
1569  &scheduler_node->Thread.Wait_node
1570  );
1572  the_thread,
1573  scheduler_node,
1575  );
1576 }
1577 
1586  Thread_Control *the_thread,
1587  Scheduler_Node *scheduler_node
1588 )
1589 {
1590  _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
1592  the_thread,
1593  scheduler_node,
1595  );
1596 }
1597 #endif
1598 
1611  const Thread_Control *the_thread
1612 )
1613 {
1614  Scheduler_Node *scheduler_node;
1615 
1616  scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
1617  return _Priority_Get_priority( &scheduler_node->Wait.Priority );
1618 }
1619 
1628  const Thread_Control *the_thread
1629 )
1630 {
1631  return SCHEDULER_PRIORITY_UNMAP( _Thread_Get_priority( the_thread ) );
1632 }
1633 
1642  const Thread_Control *the_thread
1643 )
1644 {
1645  return SCHEDULER_PRIORITY_UNMAP( the_thread->Real_priority.priority );
1646 }
1647 
1659  Thread_Control *the_thread,
1660  ISR_lock_Context *lock_context
1661 )
1662 {
1663  _ISR_lock_Acquire( &the_thread->Wait.Lock.Default, lock_context );
1664 }
1665 
1678  ISR_lock_Context *lock_context
1679 )
1680 {
1681  Thread_Control *executing;
1682 
1683  _ISR_lock_ISR_disable( lock_context );
1684  executing = _Thread_Executing;
1685  _Thread_Wait_acquire_default_critical( executing, lock_context );
1686 
1687  return executing;
1688 }
1689 
1700  Thread_Control *the_thread,
1701  ISR_lock_Context *lock_context
1702 )
1703 {
1704  _ISR_lock_ISR_disable( lock_context );
1705  _Thread_Wait_acquire_default_critical( the_thread, lock_context );
1706 }
1707 
1719  Thread_Control *the_thread,
1720  ISR_lock_Context *lock_context
1721 )
1722 {
1723  _ISR_lock_Release( &the_thread->Wait.Lock.Default, lock_context );
1724 }
1725 
1735  Thread_Control *the_thread,
1736  ISR_lock_Context *lock_context
1737 )
1738 {
1739  _Thread_Wait_release_default_critical( the_thread, lock_context );
1740  _ISR_lock_ISR_enable( lock_context );
1741 }
1742 
1743 #if defined(RTEMS_SMP)
1744 #define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \
1745  RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node )
1746 
1754  Thread_Control *the_thread,
1755  Thread_queue_Lock_context *queue_lock_context
1756 )
1757 {
1758  Chain_Node *first;
1759 
1760  _Chain_Extract_unprotected( &queue_lock_context->Wait.Gate.Node );
1761  first = _Chain_First( &the_thread->Wait.Lock.Pending_requests );
1762 
1763  if ( first != _Chain_Tail( &the_thread->Wait.Lock.Pending_requests ) ) {
1765  }
1766 }
1767 
1775  Thread_queue_Queue *queue,
1776  Thread_queue_Lock_context *queue_lock_context
1777 )
1778 {
1779  _Thread_queue_Queue_acquire_critical(
1780  queue,
1781  &_Thread_Executing->Potpourri_stats,
1782  &queue_lock_context->Lock_context
1783  );
1784 }
1785 
1793  Thread_queue_Queue *queue,
1794  Thread_queue_Lock_context *queue_lock_context
1795 )
1796 {
1798  queue,
1799  &queue_lock_context->Lock_context
1800  );
1801 }
1802 #endif
1803 
1813  Thread_Control *the_thread,
1814  Thread_queue_Context *queue_context
1815 )
1816 {
1817 #if defined(RTEMS_SMP)
1818  Thread_queue_Queue *queue;
1819 
1821  the_thread,
1822  &queue_context->Lock_context.Lock_context
1823  );
1824 
1825  queue = the_thread->Wait.queue;
1826  queue_context->Lock_context.Wait.queue = queue;
1827 
1828  if ( queue != NULL ) {
1830  &the_thread->Wait.Lock.Pending_requests,
1831  &queue_context->Lock_context.Wait.Gate
1832  );
1834  the_thread,
1835  &queue_context->Lock_context.Lock_context
1836  );
1837  _Thread_Wait_acquire_queue_critical( queue, &queue_context->Lock_context );
1838 
1839  if ( queue_context->Lock_context.Wait.queue == NULL ) {
1841  queue,
1842  &queue_context->Lock_context
1843  );
1845  the_thread,
1846  &queue_context->Lock_context.Lock_context
1847  );
1849  the_thread,
1850  &queue_context->Lock_context
1851  );
1852  _Assert( the_thread->Wait.queue == NULL );
1853  }
1854  }
1855 #else
1856  (void) the_thread;
1857  (void) queue_context;
1858 #endif
1859 }
1860 
1869  Thread_Control *the_thread,
1870  Thread_queue_Context *queue_context
1871 )
1872 {
1873  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
1874  _Thread_Wait_acquire_critical( the_thread, queue_context );
1875 }
1876 
1888  Thread_Control *the_thread,
1889  Thread_queue_Context *queue_context
1890 )
1891 {
1892 #if defined(RTEMS_SMP)
1893  Thread_queue_Queue *queue;
1894 
1895  queue = queue_context->Lock_context.Wait.queue;
1896 
1897  if ( queue != NULL ) {
1899  queue, &queue_context->Lock_context
1900  );
1902  the_thread,
1903  &queue_context->Lock_context.Lock_context
1904  );
1906  the_thread,
1907  &queue_context->Lock_context
1908  );
1909  }
1910 
1912  the_thread,
1913  &queue_context->Lock_context.Lock_context
1914  );
1915 #else
1916  (void) the_thread;
1917  (void) queue_context;
1918 #endif
1919 }
1920 
1930  Thread_Control *the_thread,
1931  Thread_queue_Context *queue_context
1932 )
1933 {
1934  _Thread_Wait_release_critical( the_thread, queue_context );
1935  _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
1936 }
1937 
1953  Thread_Control *the_thread,
1954  Thread_queue_Queue *queue
1955 )
1956 {
1957  ISR_lock_Context lock_context;
1958 
1959  _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
1960 
1961  _Assert( the_thread->Wait.queue == NULL );
1962 
1963 #if defined(RTEMS_SMP)
1965  _Chain_Initialize_node( &the_thread->Wait.Lock.Tranquilizer.Node );
1967 #endif
1968 
1969  the_thread->Wait.queue = queue;
1970 
1971  _Thread_Wait_release_default_critical( the_thread, &lock_context );
1972 }
1973 
1982  Thread_Control *the_thread,
1983  const Thread_queue_Operations *operations
1984 )
1985 {
1986  the_thread->Wait.operations = operations;
1987 }
1988 
2001  Thread_Control *the_thread,
2002  Thread_queue_Lock_context *queue_lock_context
2003 )
2004 {
2005 #if defined(RTEMS_SMP)
2006  ISR_lock_Context lock_context;
2007 
2008  _Thread_Wait_acquire_default( the_thread, &lock_context );
2009  _Thread_Wait_remove_request_locked( the_thread, queue_lock_context );
2010  _Thread_Wait_release_default( the_thread, &lock_context );
2011 #else
2012  (void) the_thread;
2013  (void) queue_lock_context;
2014 #endif
2015 }
2016 
2030  Thread_Control *the_thread
2031 )
2032 {
2033 #if defined(RTEMS_SMP)
2034  ISR_lock_Context lock_context;
2035  Chain_Node *node;
2036  const Chain_Node *tail;
2037 
2038  _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2039 
2040  node = _Chain_First( &the_thread->Wait.Lock.Pending_requests );
2041  tail = _Chain_Immutable_tail( &the_thread->Wait.Lock.Pending_requests );
2042 
2043  if ( node != tail ) {
2044  do {
2045  Thread_queue_Context *queue_context;
2046 
2047  queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
2048  queue_context->Lock_context.Wait.queue = NULL;
2049 
2050  node = _Chain_Next( node );
2051  } while ( node != tail );
2052 
2054  &the_thread->Wait.Lock.Pending_requests,
2055  &the_thread->Wait.Lock.Tranquilizer
2056  );
2057  } else {
2059  }
2060 #endif
2061 
2062  the_thread->Wait.queue = NULL;
2063  the_thread->Wait.operations = &_Thread_queue_Operations_default;
2064 
2065 #if defined(RTEMS_SMP)
2066  _Thread_Wait_release_default_critical( the_thread, &lock_context );
2067 #endif
2068 }
2069 
2089  Thread_Control *the_thread
2090 )
2091 {
2092 #if defined(RTEMS_SMP)
2094 #else
2095  (void) the_thread;
2096 #endif
2097 }
2098 
2107  Thread_Control *the_thread,
2108  Thread_queue_Context *queue_context
2109 )
2110 {
2111  Thread_queue_Queue *queue;
2112 
2113  queue = the_thread->Wait.queue;
2114 
2115 #if defined(RTEMS_SMP)
2116  if ( queue != NULL ) {
2117  _Assert( queue_context->Lock_context.Wait.queue == queue );
2118 #endif
2119 
2120  ( *the_thread->Wait.operations->extract )(
2121  queue,
2122  the_thread,
2123  queue_context
2124  );
2125  _Thread_Wait_restore_default( the_thread );
2126 
2127 #if defined(RTEMS_SMP)
2128  _Assert( queue_context->Lock_context.Wait.queue == NULL );
2129  queue_context->Lock_context.Wait.queue = queue;
2130  }
2131 #endif
2132 }
2133 
2137 #define THREAD_WAIT_FLAGS_INITIAL 0x0U
2138 
2142 #define THREAD_WAIT_STATE_MASK 0xffU
2143 
2151 #define THREAD_WAIT_STATE_INTEND_TO_BLOCK 0x1U
2152 
2156 #define THREAD_WAIT_STATE_BLOCKED 0x2U
2157 
2163 #define THREAD_WAIT_STATE_READY_AGAIN 0x4U
2164 
2168 #define THREAD_WAIT_CLASS_MASK 0xff00U
2169 
2173 #define THREAD_WAIT_CLASS_EVENT 0x100U
2174 
2178 #define THREAD_WAIT_CLASS_SYSTEM_EVENT 0x200U
2179 
2183 #define THREAD_WAIT_CLASS_OBJECT 0x400U
2184 
2188 #define THREAD_WAIT_CLASS_PERIOD 0x800U
2189 
2197  Thread_Control *the_thread,
2198  Thread_Wait_flags flags
2199 )
2200 {
2201 #if defined(RTEMS_SMP)
2202  _Atomic_Store_uint( &the_thread->Wait.flags, flags, ATOMIC_ORDER_RELAXED );
2203 #else
2204  the_thread->Wait.flags = flags;
2205 #endif
2206 }
2207 
2216  const Thread_Control *the_thread
2217 )
2218 {
2219 #if defined(RTEMS_SMP)
2220  return _Atomic_Load_uint( &the_thread->Wait.flags, ATOMIC_ORDER_RELAXED );
2221 #else
2222  return the_thread->Wait.flags;
2223 #endif
2224 }
2225 
2234  const Thread_Control *the_thread
2235 )
2236 {
2237 #if defined(RTEMS_SMP)
2238  return _Atomic_Load_uint( &the_thread->Wait.flags, ATOMIC_ORDER_ACQUIRE );
2239 #else
2240  return the_thread->Wait.flags;
2241 #endif
2242 }
2243 
2261  Thread_Control *the_thread,
2262  Thread_Wait_flags expected_flags,
2263  Thread_Wait_flags desired_flags
2264 )
2265 {
2266  _Assert( _ISR_Get_level() != 0 );
2267 
2268 #if defined(RTEMS_SMP)
2269  return _Atomic_Compare_exchange_uint(
2270  &the_thread->Wait.flags,
2271  &expected_flags,
2272  desired_flags,
2273  ATOMIC_ORDER_RELEASE,
2274  ATOMIC_ORDER_RELAXED
2275  );
2276 #else
2277  bool success = ( the_thread->Wait.flags == expected_flags );
2278 
2279  if ( success ) {
2280  the_thread->Wait.flags = desired_flags;
2281  }
2282 
2283  return success;
2284 #endif
2285 }
2286 
2301  Thread_Control *the_thread,
2302  Thread_Wait_flags expected_flags,
2303  Thread_Wait_flags desired_flags
2304 )
2305 {
2306 #if defined(RTEMS_SMP)
2307  return _Atomic_Compare_exchange_uint(
2308  &the_thread->Wait.flags,
2309  &expected_flags,
2310  desired_flags,
2311  ATOMIC_ORDER_ACQUIRE,
2312  ATOMIC_ORDER_ACQUIRE
2313  );
2314 #else
2315  bool success;
2316  ISR_Level level;
2317 
2318  _ISR_Local_disable( level );
2319 
2321  the_thread,
2322  expected_flags,
2323  desired_flags
2324  );
2325 
2326  _ISR_Local_enable( level );
2327  return success;
2328 #endif
2329 }
2330 
2347 Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread );
2348 
2355  const Thread_Control *the_thread
2356 )
2357 {
2358  return (Status_Control) the_thread->Wait.return_code;
2359 }
2360 
2373 void _Thread_Continue( Thread_Control *the_thread, Status_Control status );
2374 
2380 void _Thread_Timeout( Watchdog_Control *the_watchdog );
2381 
2389  Thread_Timer_information *timer,
2390  Per_CPU_Control *cpu
2391 )
2392 {
2393  _ISR_lock_Initialize( &timer->Lock, "Thread Timer" );
2394  timer->header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_TICKS ];
2395  _Watchdog_Preinitialize( &timer->Watchdog, cpu );
2396 }
2397 
2406  Thread_Control *the_thread,
2407  Per_CPU_Control *cpu,
2408  Watchdog_Interval ticks
2409 )
2410 {
2411  ISR_lock_Context lock_context;
2412 
2413  _ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
2414 
2415  the_thread->Timer.header =
2417  the_thread->Timer.Watchdog.routine = _Thread_Timeout;
2418  _Watchdog_Per_CPU_insert_ticks( &the_thread->Timer.Watchdog, cpu, ticks );
2419 
2420  _ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
2421 }
2422 
2432  Thread_Control *the_thread,
2433  Per_CPU_Control *cpu,
2435  uint64_t expire
2436 )
2437 {
2438  ISR_lock_Context lock_context;
2439  Watchdog_Header *header;
2440 
2441  _ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
2442 
2443  header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ];
2444  the_thread->Timer.header = header;
2445  the_thread->Timer.Watchdog.routine = routine;
2446  _Watchdog_Per_CPU_insert( &the_thread->Timer.Watchdog, cpu, header, expire );
2447 
2448  _ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
2449 }
2450 
2457 {
2458  ISR_lock_Context lock_context;
2459 
2460  _ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
2461 
2463  &the_thread->Timer.Watchdog,
2464 #if defined(RTEMS_SMP)
2465  the_thread->Timer.Watchdog.cpu,
2466 #else
2467  _Per_CPU_Get(),
2468 #endif
2469  the_thread->Timer.header
2470  );
2471 
2472  _ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
2473 }
2474 
2483  Thread_Control *the_thread,
2484  Thread_queue_Queue *queue
2485 )
2486 {
2487  _Thread_Wait_tranquilize( the_thread );
2488  _Thread_Timer_remove( the_thread );
2489 
2490 #if defined(RTEMS_MULTIPROCESSING)
2491  if ( _Objects_Is_local_id( the_thread->Object.id ) ) {
2492  _Thread_Unblock( the_thread );
2493  } else {
2494  _Thread_queue_Unblock_proxy( queue, the_thread );
2495  }
2496 #else
2497  (void) queue;
2498  _Thread_Unblock( the_thread );
2499 #endif
2500 }
2501 
2511 Status_Control _Thread_Set_name(
2512  Thread_Control *the_thread,
2513  const char *name
2514 );
2515 
2525 size_t _Thread_Get_name(
2526  const Thread_Control *the_thread,
2527  char *buffer,
2528  size_t buffer_size
2529 );
2530 
2531 #if defined(RTEMS_SMP)
2532 #define THREAD_PIN_STEP 2
2533 
2534 #define THREAD_PIN_PREEMPTION 1
2535 
2542 void _Thread_Do_unpin(
2543  Thread_Control *executing,
2544  Per_CPU_Control *cpu_self
2545 );
2546 #endif
2547 
2554 {
2555 #if defined(RTEMS_SMP)
2556  _Assert( executing == _Thread_Executing );
2557 
2558  executing->Scheduler.pin_level += THREAD_PIN_STEP;
2559 #else
2560  (void) executing;
2561 #endif
2562 }
2563 
2571  Thread_Control *executing,
2572  Per_CPU_Control *cpu_self
2573 )
2574 {
2575 #if defined(RTEMS_SMP)
2576  unsigned int pin_level;
2577 
2578  _Assert( executing == _Thread_Executing );
2579 
2580  pin_level = executing->Scheduler.pin_level;
2581  _Assert( pin_level > 0 );
2582 
2583  if (
2585  pin_level != ( THREAD_PIN_STEP | THREAD_PIN_PREEMPTION )
2586  )
2587  ) {
2588  executing->Scheduler.pin_level = pin_level - THREAD_PIN_STEP;
2589  } else {
2590  _Thread_Do_unpin( executing, cpu_self );
2591  }
2592 #else
2593  (void) executing;
2594  (void) cpu_self;
2595 #endif
2596 }
2597 
2600 #ifdef __cplusplus
2601 }
2602 #endif
2603 
2604 #if defined(RTEMS_MULTIPROCESSING)
2605 #include <rtems/score/threadmp.h>
2606 #endif
2607 
2608 #endif
2609 /* end of include file */
Thread_queue_Gate Tranquilizer
Tranquilizer gate used by _Thread_Wait_tranquilize().
Definition: thread.h:464
static __inline__ Objects_Information * _Thread_Get_objects_information(Objects_Id id)
Gets object information for the object id.
Definition: threadimpl.h:826
static __inline__ void _Thread_Unblock(Thread_Control *the_thread)
Unblocks the thread.
Definition: threadimpl.h:965
void _Thread_Yield(Thread_Control *executing)
Yields the currently executing thread.
Definition: threadyield.c:30
Constants and Prototypes Related to the Internal Error Handler.
void _Thread_Load_environment(Thread_Control *the_thread)
Initializes enviroment for a thread.
Definition: threadloadenv.c:24
const struct _Scheduler_Control * home_scheduler
The home scheduler of this thread.
Definition: thread.h:258
Watchdog_Service_routine(* Watchdog_Service_routine_entry)(Watchdog_Control *)
Pointer to a watchdog service routine.
Definition: watchdog.h:66
Index for realtime clock per-CPU watchdog header.
Definition: percpu.h:325
void _Thread_Get_CPU_time_used(Thread_Control *the_thread, Timestamp_Control *cpu_time_used)
Gets the used cpu time of the thread and stores it in the given Timestamp_Control.
Timestamp_Control cpu_time_used
Definition: thread.h:820
static __inline__ Chain_Node * _Chain_First(const Chain_Control *the_chain)
Returns pointer to chain&#39;s first node.
Definition: chainimpl.h:260
Thread_CPU_budget_algorithms budget_algorithm
The thread&#39;s budget algorithm.
Definition: threadimpl.h:161
Thread_Life_state state
The current thread life state.
Definition: thread.h:693
static __inline__ bool _Objects_Is_local_id(Objects_Id id RTEMS_UNUSED)
Checks if the id is of a local object.
Definition: objectimpl.h:587
#define _Context_Save_fp(_fp)
Save floating point context area.
Definition: context.h:153
static void _TOD_Get_uptime(Timestamp_Control *time)
Gets the system uptime with potential accuracy to the nanosecond.
Definition: todimpl.h:231
static __inline__ void _Thread_Action_control_initialize(Thread_Action_control *action_control)
Initializes the control chain of the action control.
Definition: threadimpl.h:1208
const Thread_queue_Operations * operations
The current thread queue operations.
Definition: thread.h:491
int64_t Timestamp_Control
Definition: timestamp.h:57
void _Thread_Scheduler_process_requests(Thread_Control *the_thread)
Process the thread&#39;s scheduler requests.
static __inline__ void _Thread_Add_timeout_ticks(Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Interval ticks)
Adds timeout ticks to the thread.
Definition: threadimpl.h:2405
static __inline__ Thread_Wait_flags _Thread_Wait_flags_get_acquire(const Thread_Control *the_thread)
Gets the thread&#39;s wait flags according to the ATOMIC_ORDER_ACQUIRE.
Definition: threadimpl.h:2233
#define _Context_Restore_fp(_fp)
Restore floating point context area.
Definition: context.h:142
void _Thread_Close(Thread_Control *the_thread, Thread_Control *executing, Thread_Close_context *context)
Closes the thread.
struct Per_CPU_Control * cpu
This field references the processor of this watchdog control.
Definition: watchdog.h:110
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition: watchdogticks.h:38
Atomic_Uint flags
This field contains several flags used to control the wait class and state of a thread in case fine-g...
Definition: thread.h:420
Thread_Life_state
Thread life states.
Definition: thread.h:672
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:257
Watchdog_Header Header[PER_CPU_WATCHDOG_COUNT]
Header for watchdogs.
Definition: percpu.h:474
static __inline__ void _Thread_Wait_restore_default(Thread_Control *the_thread)
Restores the default thread wait queue and operations.
Definition: threadimpl.h:2029
static __inline__ bool _Thread_Is_life_change_allowed(Thread_Life_state life_state)
Checks if the thread life state allos life change.
Definition: threadimpl.h:1294
Thread_Wait_information Wait
Definition: thread.h:767
#define _ISR_Local_disable(_level)
Disables interrupts on this processor.
Definition: isrlevel.h:57
static __inline__ Objects_Control * _Objects_Allocate_unprotected(Objects_Information *information)
Allocates an object without locking the allocator mutex.
Definition: objectimpl.h:877
Thread queue context for the thread queue methods.
Definition: threadq.h:198
static __inline__ bool _Chain_Is_node_off_chain(const Chain_Node *node)
Checks if the node is off chain.
Definition: chainimpl.h:142
static __inline__ Scheduler_Node * _Thread_Scheduler_get_node_by_index(const Thread_Control *the_thread, size_t scheduler_index)
Gets the thread&#39;s scheduler node by index.
Definition: threadimpl.h:1460
The priority node to build up a priority aggregation.
Definition: priority.h:98
struct _Thread_Control * executing
This is the thread executing on this processor.
Definition: percpu.h:420
Thread entry information.
Definition: thread.h:130
static __inline__ void _Thread_State_release_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Release the lock context in a critical section.
Definition: threadimpl.h:578
Scheduler_Node * next_request
Link to the next scheduler node in the Thread_Control::Scheduler::requests list.
void _Thread_Kill_zombies(void)
Kills all zombie threads in the system.
static __inline__ bool _Thread_Is_heir(const Thread_Control *the_thread)
Checks if the thread is the heir.
Definition: threadimpl.h:949
static __inline__ void _Thread_State_acquire_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the lock context in a critical section.
Definition: threadimpl.h:528
static __inline__ const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
Definition: threadimpl.h:1419
Data Related to the Management of Processor Interrupt Levels.
static __inline__ void _Chain_Initialize_node(Chain_Node *the_node)
Initializes a chain node.
Definition: chainimpl.h:122
Inlined Routines in the Watchdog Handler.
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
static __inline__ void _Thread_Pin(Thread_Control *executing)
Pin the executing thread.
Definition: threadimpl.h:2553
static __inline__ void _Thread_Unpin(Thread_Control *executing, Per_CPU_Control *cpu_self)
Unpins the thread.
Definition: threadimpl.h:2570
static __inline__ Priority_Control _Thread_Priority_highest(Priority_Control left, Priority_Control right)
Returns the highest priority of the left and right thread priorities in the intuitive sense of priori...
Definition: threadimpl.h:810
static __inline__ bool _Thread_Is_executing_on_a_processor(const Thread_Control *the_thread)
Checks if the thread executes currently on some processor in the system.
Definition: threadimpl.h:930
Thread_Life_state _Thread_Change_life(Thread_Life_state clear, Thread_Life_state set, Thread_Life_state ignore)
Changes the currently executing thread to a new state with the sets.
struct Per_CPU_Control * cpu
The processor assigned by the current scheduler.
Definition: thread.h:268
static __inline__ bool _Thread_Is_life_restarting(Thread_Life_state life_state)
Checks if the thread life state is restarting.
Definition: threadimpl.h:1264
static __inline__ void _Thread_Add_post_switch_action(Thread_Control *the_thread, Thread_Action *action, Thread_Action_handler handler)
Adds a post switch action to the thread with the given handler.
Definition: threadimpl.h:1234
static __inline__ void _Thread_Resource_count_increment(Thread_Control *the_thread)
Increments the thread&#39;s resource count.
Definition: threadimpl.h:1339
void _Thread_Exit(Thread_Control *executing, Thread_Life_state set, void *exit_value)
Exits the currently executing thread.
The control block used to manage each watchdog timer.
Definition: watchdog.h:90
#define STATES_BLOCKED
Definition: statesimpl.h:135
void _Thread_Do_unpin(Thread_Control *executing, Per_CPU_Control *cpu_self)
Unpins the thread.
Definition: threadunpin.c:15
static __inline__ Thread_Control * _Thread_Wait_acquire_default_for_executing(ISR_lock_Context *lock_context)
Acquires the thread wait default lock and returns the executing thread.
Definition: threadimpl.h:1677
void _Thread_Entry_adaptor_pointer(Thread_Control *executing)
Calls the start kinds pointer entry of the thread.
uint32_t return_code
Definition: thread.h:413
void * rtems_ada_self
static __inline__ bool _Thread_Wait_flags_try_change_acquire(Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
Tries to change the thread wait flags with acquire semantics.
Definition: threadimpl.h:2300
struct Thread_Wait_information::@26 Lock
Thread wait lock control block.
Priority_Control priority
The priority value of this node.
Definition: priority.h:110
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:416
Scheduler Node Implementation.
void _Thread_Continue(Thread_Control *the_thread, Status_Control status)
Cancels a blocking operation so that the thread can continue its execution.
Definition: threadtimeout.c:25
Thread_Scheduler_control Scheduler
Scheduler related control.
Definition: thread.h:764
Information required to manage a thread timer.
Definition: thread.h:499
ISR_lock_Control Default
Thread wait default lock.
Definition: thread.h:447
void _Thread_Priority_and_sticky_update(Thread_Control *the_thread, int sticky_level_change)
Updates the priority of the thread and changes it sticky level.
Thread_queue_Queue * queue
The current thread queue.
Definition: thread.h:482
static __inline__ Thread_Wait_flags _Thread_Wait_flags_get(const Thread_Control *the_thread)
Gets the thread&#39;s wait flags according to the ATOMIC_ORDER_RELAXED.
Definition: threadimpl.h:2215
static __inline__ void _Thread_Resource_count_decrement(Thread_Control *the_thread)
Decrements the thread&#39;s resource count.
Definition: threadimpl.h:1355
Scheduler_Node_request
The scheduler node requests.
Definition: schedulernode.h:47
Objects_Information Objects
The object information.
Definition: thread.h:1004
static __inline__ void _Thread_Timer_insert_realtime(Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Service_routine_entry routine, uint64_t expire)
Inserts the cpu&#39;s watchdog realtime into the thread&#39;s timer.
Definition: threadimpl.h:2431
static __inline__ void _Thread_queue_Queue_release_critical(Thread_queue_Queue *queue, ISR_lock_Context *lock_context)
Releases the thread queue queue in a critical section.
Definition: threadqimpl.h:603
Thread_Control * _Thread_Get(Objects_Id id, ISR_lock_Context *lock_context)
Gets a thread by its identifier.
Definition: threadget.c:24
static __inline__ void _Thread_State_release(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context and enables interrupts.
Definition: threadimpl.h:592
struct Scheduler_Node::@19 Thread
Block to register and manage this scheduler node in the thread control block of the owner of this sch...
static __inline__ bool _Thread_Is_null(const Thread_Control *the_thread)
Checks if the thread is NULL.
Definition: threadimpl.h:1082
static __inline__ void _Thread_Timer_initialize(Thread_Timer_information *timer, Per_CPU_Control *cpu)
Initializes the thread timer.
Definition: threadimpl.h:2388
bool _Thread_Initialize(Thread_Information *information, Thread_Control *the_thread, const Thread_Configuration *config)
Initializes thread.
Helpers for Manipulating Timestamps.
#define _ISR_Get_level()
Return current interrupt level.
Definition: isrlevel.h:128
Timestamp_Control cpu_usage_timestamp
The CPU usage timestamp contains the time point of the last heir thread change or last CPU usage upda...
Definition: percpu.h:452
static __inline__ void _Thread_queue_Gate_close(Thread_queue_Gate *gate)
Closes the gate.
Definition: threadqimpl.h:468
Scheduler_Node * requests
List of pending scheduler node requests.
Definition: thread.h:316
static __inline__ void _Thread_Restore_fp(Thread_Control *executing)
Restores the executing thread&#39;s floating point area.
Definition: threadimpl.h:1029
Watchdog_Service_routine_entry routine
This field is the function to invoke.
Definition: watchdog.h:114
Thread_queue_Queue * queue
The thread queue in case the thread is blocked on a thread queue.
Definition: threadq.h:147
Scheduler_Node_request request
The current scheduler node request.
Objects_Name name
Name of the object for the thread.
Definition: threadimpl.h:171
uint32_t States_Control
Definition: states.h:46
Thread queue operations.
Definition: threadq.h:517
static __inline__ void _Watchdog_Preinitialize(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu)
Pre-initializes a watchdog.
Definition: watchdogimpl.h:214
There is a pending scheduler node request to remove this scheduler node from the Thread_Control::Sche...
Definition: schedulernode.h:63
void _Thread_queue_Do_acquire_critical(Thread_queue_Control *the_thread_queue, ISR_lock_Context *lock_context)
Acquires the thread queue control in a critical section.
Definition: threadq.c:72
Information for the Assert Handler.
There is a pending scheduler node request to add this scheduler node to the Thread_Control::Scheduler...
Definition: schedulernode.h:57
void _Thread_Join(Thread_Control *the_thread, States_Control waiting_for_join, Thread_Control *executing, Thread_queue_Context *queue_context)
Joins the currently executing thread with the given thread to wait for.
static __inline__ void _Thread_Scheduler_add_request(Thread_Control *the_thread, Scheduler_Node *scheduler_node, Scheduler_Node_request request)
Add a scheduler request to the thread.
Definition: threadimpl.h:1519
Chain_Node Wait_node
Node to add this scheduler node to Thread_Control::Scheduler::Wait_nodes.
static __inline__ void _Thread_queue_Gate_open(Thread_queue_Gate *gate)
Opens the gate.
Definition: threadqimpl.h:494
static __inline__ void _Thread_Wait_acquire_critical(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1812
static __inline__ void _Chain_Append_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Appends a node (unprotected).
Definition: chainimpl.h:680
static __inline__ void _Timestamp_Subtract(const Timestamp_Control *_start, const Timestamp_Control *_end, Timestamp_Control *_result)
Subtracts two timestamps.
Inlined Routines in the Object Handler.
void _Thread_Priority_changed(Thread_Control *the_thread, Priority_Node *priority_node, bool prepend_it, Thread_queue_Context *queue_context)
Propagates a thread priority value change in the specified thread priority node to the corresponding ...
static __inline__ void _Thread_Action_initialize(Thread_Action *action)
Initializes the Thread action.
Definition: threadimpl.h:1220
struct Thread_queue_Lock_context::@28 Wait
Data to support thread queue enqueue operations.
static __inline__ uint64_t _Watchdog_Per_CPU_insert(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Header *header, uint64_t expire)
Sets the watchdog&#39;s cpu and inserts it with the given expiration time in the scheduled watchdogs...
Definition: watchdogimpl.h:625
void _Thread_Timeout(Watchdog_Control *the_watchdog)
General purpose thread wait timeout.
Definition: threadtimeout.c:83
static __inline__ void _Thread_Save_fp(Thread_Control *executing)
Checks if the floating point context of the thread is currently loaded in the floating point unit...
Definition: threadimpl.h:1014
static __inline__ void _Thread_Wait_flags_set(Thread_Control *the_thread, Thread_Wait_flags flags)
Sets the thread&#39;s wait flags.
Definition: threadimpl.h:2196
Priority_Control priority
The new thread&#39;s priority.
Definition: threadimpl.h:156
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:207
static __inline__ void _Thread_Scheduler_cancel_need_for_help(Thread_Control *the_thread, Per_CPU_Control *cpu)
Cancels the thread&#39;s need for help.
Definition: threadimpl.h:1394
unsigned int Thread_Wait_flags
This type is able to contain several flags used to control the wait class and state of a thread...
Definition: thread.h:383
Thread_queue_Gate Gate
Gate to synchronize thread wait lock requests.
Definition: threadq.h:142
int pin_level
The thread pinning to current processor level.
Definition: thread.h:338
Control block to manage thread actions.
Definition: thread.h:658
const struct _Scheduler_Control * scheduler
The scheduler control instance for the thread.
Definition: threadimpl.h:134
Per CPU Core Structure.
Definition: percpu.h:347
static __inline__ void _Thread_Timer_remove(Thread_Control *the_thread)
Remove the watchdog timer from the thread.
Definition: threadimpl.h:2456
Objects_Id _Thread_Global_constructor
Object identifier of the global constructor thread.
Definition: threadhandler.c:53
Thread_Life_state _Thread_Set_life_protection(Thread_Life_state state)
Set the thread to life protected.
uint32_t ISR_Level
Definition: isrlevel.h:41
States_Control _Thread_Set_state_locked(Thread_Control *the_thread, States_Control state)
Sets the specified thread state without locking the lock context.
The scheduler node is not on the list of pending requests.
Definition: schedulernode.h:51
static __inline__ Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler&#39;s home node.
Definition: threadimpl.h:1438
static __inline__ void _Thread_Wait_acquire(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait default lock and disables interrupts.
Definition: threadimpl.h:1868
The configuration of a new thread to initialize.
Definition: threadimpl.h:130
static __inline__ Chain_Node * _Chain_Next(const Chain_Node *the_node)
Returns pointer to the next node from this node.
Definition: chainimpl.h:327
The thread object information.
Definition: thread.h:1000
static __inline__ void _Thread_queue_Gate_wait(Thread_queue_Gate *gate)
Waits on a gate to open.
Definition: threadqimpl.h:508
static __inline__ bool _Thread_Is_context_switch_necessary(void)
Deallocates the currently loaded floating point context.
Definition: threadimpl.h:1069
Status_Control _Thread_Set_name(Thread_Control *the_thread, const char *name)
Sets the name of the thread.
static __inline__ void _Thread_Wait_remove_request(Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context)
Removes a thread wait lock request.
Definition: threadimpl.h:2000
void _Thread_Start_multitasking(void) RTEMS_NO_RETURN
Starts thread multitasking.
static __inline__ void _Thread_Set_CPU(Thread_Control *thread, Per_CPU_Control *cpu)
Sets the cpu of the thread&#39;s scheduler.
Definition: threadimpl.h:886
void _Thread_Create_idle(void)
Creates idle thread.
Thread action.
Definition: thread.h:633
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:203
Objects_Control Object
Definition: thread.h:727
static __inline__ bool _Thread_Wait_flags_try_change_release(Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
Tries to change the thread wait flags with release semantics in case of success.
Definition: threadimpl.h:2260
size_t stack_size
The size of the stack area in bytes.
Definition: threadimpl.h:144
Objects_Id _Thread_Wait_get_id(const Thread_Control *the_thread)
Returns the object identifier of the object containing the current thread wait queue.
Thread_queue_Extract_operation extract
Thread queue extract operation.
Definition: threadq.h:535
Thread_CPU_budget_algorithm_callout budget_callout
The thread&#39;s initial budget callout.
Definition: threadimpl.h:166
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
Definition: isrlevel.h:74
static __inline__ void _Timestamp_Add_to(Timestamp_Control *_time, const Timestamp_Control *_add)
Adds two timestamps.
struct Per_CPU_Control::@13 Watchdog
Watchdog state for this processor.
Constants and Structures Associated with the Manipulation of Objects.
States_Control _Thread_Clear_state(Thread_Control *the_thread, States_Control state)
Clears the specified thread state.
static __inline__ void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
Definition: chainimpl.h:558
States_Control current_state
Definition: thread.h:749
static __inline__ void _Thread_Dispatch_request(Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_target)
Requests a thread dispatch on the target processor.
void _Thread_Priority_replace(Thread_Control *the_thread, Priority_Node *victim_node, Priority_Node *replacement_node)
Replaces the victim priority node with the replacement priority node in the corresponding thread prio...
#define SCHEDULER_PRIORITY_UNMAP(priority)
Returns the plain priority value.
static __inline__ bool _Thread_Priority_less_than(Priority_Control left, Priority_Control right)
Checks if the left thread priority is less than the right thread priority in the intuitive sense of p...
Definition: threadimpl.h:793
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
Chain_Node Help_node
Node for the Per_CPU_Control::Threads_in_need_for_help chain.
Definition: thread.h:302
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:284
static __inline__ void _Thread_Scheduler_acquire_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the lock context in a critical section.
Definition: threadimpl.h:1483
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
#define _ISR_lock_Release(_lock, _context)
Releases an ISR lock inside an ISR disabled section.
Definition: isrlock.h:310
static __inline__ void _Thread_Scheduler_release_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context in a critical section.
Definition: threadimpl.h:1497
static __inline__ Priority_Control _Thread_Get_priority(const Thread_Control *the_thread)
Returns the priority of the thread.
Definition: threadimpl.h:1610
static __inline__ uint64_t _Watchdog_Per_CPU_insert_ticks(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Interval ticks)
Sets the watchdog&#39;s cpu to the given instance and sets its expiration time to the watchdog expiration...
Definition: watchdogimpl.h:593
static __inline__ void _Thread_Wait_acquire_default(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the thread wait default lock and disables interrupts.
Definition: threadimpl.h:1699
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
static __inline__ void _Priority_Node_set_priority(Priority_Node *node, Priority_Control priority)
Sets the priority of the priority node to the given priority.
Definition: priorityimpl.h:171
States_Control _Thread_Set_state(Thread_Control *the_thread, States_Control state)
Sets the specified thread state.
void _Thread_Iterate(Thread_Visitor visitor, void *arg)
Calls the visitor with all threads and the given argument until it is done.
Definition: threaditerate.c:21
Chain Handler API.
static __inline__ void _Thread_Wait_release_queue_critical(Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context)
Releases the wait queue inside a critical section.
Definition: threadimpl.h:1792
static __inline__ bool _States_Is_ready(States_Control the_states)
Checks if the state is ready.
Definition: statesimpl.h:195
Thread_CPU_budget_algorithms
Definition: thread.h:158
static __inline__ void _Thread_Remove_timer_and_unblock(Thread_Control *the_thread, Thread_queue_Queue *queue)
Remove the watchdog timer from the thread and unblock if necessary.
Definition: threadimpl.h:2482
void _Thread_Priority_perform_actions(Thread_Control *start_of_path, Thread_queue_Context *queue_context)
Checks if the thread is owner of the lock of the join queue.
Time of Day Handler API.
static __inline__ bool _Thread_Is_executing(const Thread_Control *the_thread)
Checks if the thread is the currently executing thread.
Definition: threadimpl.h:910
Inlined Routines Associated with Thread State Information.
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
Definition: percpu.h:400
static __inline__ bool _Thread_Is_joinable(const Thread_Control *the_thread)
Checks if the thread is joinable.
Definition: threadimpl.h:1326
#define _ISR_lock_ISR_disable_and_acquire(_lock, _context)
Acquires an ISR lock.
Definition: isrlock.h:232
const size_t _Scheduler_Node_size
The size of a scheduler node.
struct _Thread_Control * heir
This is the heir thread for this processor.
Definition: percpu.h:436
struct Scheduler_Node::@20 Wait
Thread wait support block.
void _Thread_Entry_adaptor_idle(Thread_Control *executing)
Calls the start kinds idle entry of the thread.
static __inline__ Per_CPU_Control * _Thread_Get_CPU(const Thread_Control *thread)
Gets the cpu of the thread&#39;s scheduler.
Definition: threadimpl.h:867
void _Thread_Restart_self(Thread_Control *executing, const Thread_Entry_information *entry, ISR_lock_Context *lock_context) RTEMS_NO_RETURN
Restarts the currently executing thread.
void _Thread_Entry_adaptor_numeric(Thread_Control *executing)
Calls the start kinds numeric entry of the thread.
The watchdog header to manage scheduled watchdogs.
Definition: watchdog.h:71
static __inline__ void _Chain_Initialize_empty(Chain_Control *the_chain)
Initializes this chain as empty.
Definition: chainimpl.h:505
static __inline__ Priority_Control _Thread_Get_unmapped_real_priority(const Thread_Control *the_thread)
Returns the unmapped real priority of the thread.
Definition: threadimpl.h:1641
void _Thread_queue_Do_release_critical(Thread_queue_Control *the_thread_queue, ISR_lock_Context *lock_context)
Checks if the thread queue control is the owner of the lock.
Definition: threadq.c:103
static __inline__ void _Thread_Wait_tranquilize(Thread_Control *the_thread)
Tranquilizes the thread after a wait on a thread queue.
Definition: threadimpl.h:2088
States_Control _Thread_Clear_state_locked(Thread_Control *the_thread, States_Control state)
Clears the specified thread state without locking the lock context.
bool is_fp
Indicates whether the thread needs a floating-point area.
Definition: threadimpl.h:181
System State Handler API.
void * stack_area
The starting address of the stack area.
Definition: threadimpl.h:139
void _Thread_Handler(void)
Wrapper function for all threads.
Definition: threadhandler.c:76
void(* Thread_CPU_budget_algorithm_callout)(Thread_Control *)
Definition: thread.h:172
Thread_queue_Control Join_queue
Thread queue for thread join operations and multi-purpose lock.
Definition: thread.h:746
static __inline__ void _Watchdog_Per_CPU_remove(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Header *header)
Removes the watchdog from the cpu and the scheduled watchdogs.
Definition: watchdogimpl.h:649
Scheduler control.
Definition: scheduler.h:264
Scheduler node for per-thread data.
Definition: schedulernode.h:79
bool _Thread_Start(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Starts the specified thread.
Definition: threadstart.c:26
The thread queue gate is an SMP synchronization means.
Definition: threadq.h:118
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
Definition: isrlock.h:392
static __inline__ Priority_Control _Thread_Get_unmapped_priority(const Thread_Control *the_thread)
Returns the unmapped priority of the thread.
Definition: threadimpl.h:1627
static __inline__ Priority_Control _Priority_Get_priority(const Priority_Aggregation *aggregation)
Gets the priority aggregation&#39;s priority.
Definition: priorityimpl.h:270
static __inline__ Status_Control _Thread_Wait_get_status(const Thread_Control *the_thread)
Get the status of the wait return code of the thread.
Definition: threadimpl.h:2354
Chain_Control Pending_requests
The pending thread wait lock acquire or tranquilize requests in case the thread is enqueued on a thre...
Definition: thread.h:453
#define _ISR_lock_Initialize(_lock, _name)
Initializes an ISR lock.
Definition: isrlock.h:182
void _Thread_Priority_remove(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Removes the specified thread priority node from the corresponding thread priority aggregation...
bool is_preemptible
Indicates whether the new thread is preemptible.
Definition: threadimpl.h:186
static __inline__ Thread_Control * _Thread_State_acquire_for_executing(ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock context for the currently executing thread.
Definition: threadimpl.h:559
uint32_t Objects_Id
Definition: object.h:80
static __inline__ void _Thread_Wait_acquire_default_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the thread wait default lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1658
static __inline__ uint32_t _Thread_Get_maximum_internal_threads(void)
Gets the maximum number of internal threads.
Definition: threadimpl.h:1094
void _Thread_Handler_initialization(void)
Initializes thread handler.
Definition: thread.c:58
static __inline__ void _Chain_Set_off_chain(Chain_Node *node)
Sets off chain.
Definition: chainimpl.h:104
static __inline__ void _Thread_Dispatch_update_heir(Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_for_heir, Thread_Control *heir)
Updates the used cpu time for the heir and dispatches a new heir.
Definition: threadimpl.h:1177
Chain_Control Wait_nodes
Scheduler nodes immediately available to the thread by its home scheduler and due to thread queue own...
Definition: thread.h:279
Scheduler_Node * nodes
The scheduler nodes of this thread.
Definition: thread.h:351
static __inline__ bool _Thread_Is_life_terminating(Thread_Life_state life_state)
Checks if the thread life state is terminating.
Definition: threadimpl.h:1279
static __inline__ void _Thread_Scheduler_remove_wait_node(Thread_Control *the_thread, Scheduler_Node *scheduler_node)
Remove a wait node from the thread and add a corresponding request to it.
Definition: threadimpl.h:1585
static __inline__ Thread_Control * _Thread_Internal_allocate(void)
Allocates an internal thread and returns it.
Definition: threadimpl.h:1116
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
static __inline__ void _Thread_Wait_release(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Releases the thread wait lock and restores the previous interrupt status.
Definition: threadimpl.h:1929
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:130
static __inline__ void _Thread_Wait_claim_finalize(Thread_Control *the_thread, const Thread_queue_Operations *operations)
Finalizes the thread wait queue claim via registration of the corresponding thread queue operations...
Definition: threadimpl.h:1981
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683
static __inline__ bool _Thread_Is_life_changing(Thread_Life_state life_state)
Checks if the thread life state is life changing.
Definition: threadimpl.h:1310
Index for tick clock per-CPU watchdog header.
Definition: percpu.h:316
static __inline__ void _Thread_Wait_release_default_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the thread wait default lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1718
static __inline__ bool _Thread_Is_ready(const Thread_Control *the_thread)
Checks if the thread is ready.
Definition: threadimpl.h:401
void _Thread_Priority_add(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Adds the specified thread priority node to the corresponding thread priority aggregation.
#define rtems_configuration_get_maximum_processors()
Returns the maximum number of processors which are configured for this application.
Definition: config.h:194
static __inline__ void _Thread_Priority_change(Thread_Control *the_thread, Priority_Node *priority_node, Priority_Control new_priority, bool prepend_it, Thread_queue_Context *queue_context)
Changes the thread priority value of the specified thread priority node in the corresponding thread p...
Definition: threadimpl.h:722
void _Thread_Cancel(Thread_Control *the_thread, Thread_Control *executing, void *exit_value)
Cancels the thread.
ISR_lock_Control Lock
Lock to protect the scheduler node change requests.
Definition: thread.h:248
uint32_t isr_level
The thread&#39;s initial ISR level.
Definition: threadimpl.h:176
Context_Control Registers
Definition: thread.h:830
static __inline__ void _Thread_Wait_cancel(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Cancels a thread wait on a thread queue.
Definition: threadimpl.h:2106
static __inline__ bool _Objects_Is_api_valid(uint32_t the_api)
Checks if the api is valid.
Definition: objectimpl.h:552
The scheduler node is on the list of pending requests, but nothing should change. ...
Definition: schedulernode.h:69
Thread_Information _Thread_Information
The internal thread objects information.
static __inline__ void _Thread_Wait_release_critical(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Releases the thread wait lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1887
#define RTEMS_PREDICT_TRUE(_exp)
Returns the value of the specified integral expression and tells the compiler that the predicted valu...
Definition: basedefs.h:765
static __inline__ bool _Chain_Is_empty(const Chain_Control *the_chain)
Checks if the chain is empty.
Definition: chainimpl.h:393
static __inline__ void _Thread_State_acquire(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock_context.
Definition: threadimpl.h:542
static __inline__ void _Chain_Append_if_is_off_chain_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Appends a node on the end of a chain if the node is in the off chain state (unprotected).
Definition: chainimpl.h:711
Thread_Life_control Life
Thread life-cycle control.
Definition: thread.h:852
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:754
Constants and Structures Related with the Thread Control Block.
void(* Thread_Action_handler)(Thread_Control *the_thread, Thread_Action *action, ISR_lock_Context *lock_context)
Thread action handler.
Definition: thread.h:613
static __inline__ void _Thread_Wait_claim(Thread_Control *the_thread, Thread_queue_Queue *queue)
Claims the thread wait queue.
Definition: threadimpl.h:1952
size_t _Thread_Get_name(const Thread_Control *the_thread, char *buffer, size_t buffer_size)
Gets the name of the thread.
static __inline__ Objects_APIs _Objects_Get_API(Objects_Id id)
Returns the API portion of the ID.
Definition: object.h:255
static __inline__ void _Thread_Wait_release_default(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the thread wait default lock and restores the previous interrupt status. ...
Definition: threadimpl.h:1734
static __inline__ void _Thread_Wait_acquire_queue_critical(Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context)
Acquires the wait queue inside a critical section.
Definition: threadimpl.h:1774
static __inline__ Chain_Node * _Chain_Tail(Chain_Control *the_chain)
Returns pointer to chain tail.
Definition: chainimpl.h:227
static __inline__ void _Thread_queue_Gate_add(Chain_Control *chain, Thread_queue_Gate *gate)
Adds the gate to the chain.
Definition: threadqimpl.h:481
static __inline__ void _Thread_Scheduler_add_wait_node(Thread_Control *the_thread, Scheduler_Node *scheduler_node)
Adds a wait node to the thread and adds a corresponding request to the thread.
Definition: threadimpl.h:1562
static __inline__ const Chain_Node * _Chain_Immutable_tail(const Chain_Control *the_chain)
Returns pointer to immutable chain tail.
Definition: chainimpl.h:243
void _Thread_Initialize_information(Thread_Information *information)
Initializes the thread information.
Definition: thread.c:46
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100
static __inline__ void _Thread_Update_CPU_time_used(Thread_Control *the_thread, Per_CPU_Control *cpu)
Updates the cpu time used of the thread.
Definition: threadimpl.h:1155
static __inline__ Thread_Control * _Thread_Get_heir_and_make_it_executing(Per_CPU_Control *cpu_self)
Gets the heir of the processor and makes it executing.
Definition: threadimpl.h:1135
Thread_Timer_information Timer
Definition: thread.h:769
bool _Thread_Restart_other(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.
static __inline__ void _Thread_Wait_remove_request_locked(Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context)
Removes the first pending wait lock request.
Definition: threadimpl.h:1753
Objects_Id id
Definition: objectdata.h:43