RTEMS  5.1
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 )
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 
150 
155 
160 
165 
170 
174  uint32_t isr_level;
175 
179  bool is_fp;
180 
186 
207 bool _Thread_Initialize(
208  Thread_Information *information,
209  Thread_Control *the_thread,
211 );
212 
223 bool _Thread_Start(
224  Thread_Control *the_thread,
226  ISR_lock_Context *lock_context
227 );
228 
237  Thread_Control *executing,
239  ISR_lock_Context *lock_context
241 
253  Thread_Control *the_thread,
255  ISR_lock_Context *lock_context
256 );
257 
263 void _Thread_Yield( Thread_Control *executing );
264 
275  Thread_Life_state clear,
276  Thread_Life_state set,
277  Thread_Life_state ignore
278 );
279 
291 
301 void _Thread_Kill_zombies( void );
302 
310 void _Thread_Exit(
311  Thread_Control *executing,
312  Thread_Life_state set,
313  void *exit_value
314 );
315 
325 void _Thread_Join(
326  Thread_Control *the_thread,
327  States_Control waiting_for_join,
328  Thread_Control *executing,
329  Thread_queue_Context *queue_context
330 );
331 
339 void _Thread_Cancel(
340  Thread_Control *the_thread,
341  Thread_Control *executing,
342  void *exit_value
343 );
344 
345 typedef struct {
347  Thread_Control *cancel;
349 
361 void _Thread_Close(
362  Thread_Control *the_thread,
363  Thread_Control *executing,
365 );
366 
376 {
377  return _States_Is_ready( the_thread->current_state );
378 }
379 
392  Thread_Control *the_thread,
393  States_Control state
394 );
395 
408  Thread_Control *the_thread,
409  States_Control state
410 );
411 
424  Thread_Control *the_thread,
425  States_Control state
426 );
427 
440  Thread_Control *the_thread,
441  States_Control state
442 );
443 
453  Thread_Control *the_thread
454 );
455 
461 void _Thread_Entry_adaptor_idle( Thread_Control *executing );
462 
469 
478 
494 void _Thread_Handler( void );
495 
503  Thread_Control *the_thread,
504  ISR_lock_Context *lock_context
505 )
506 {
507  _Thread_queue_Do_acquire_critical( &the_thread->Join_queue, lock_context );
508 }
509 
517  Thread_Control *the_thread,
518  ISR_lock_Context *lock_context
519 )
520 {
521  _ISR_lock_ISR_disable( lock_context );
522  _Thread_State_acquire_critical( the_thread, lock_context );
523 }
524 
534  ISR_lock_Context *lock_context
535 )
536 {
537  Thread_Control *executing;
538 
539  _ISR_lock_ISR_disable( lock_context );
540  executing = _Thread_Executing;
541  _Thread_State_acquire_critical( executing, lock_context );
542 
543  return executing;
544 }
545 
553  Thread_Control *the_thread,
554  ISR_lock_Context *lock_context
555 )
556 {
557  _Thread_queue_Do_release_critical( &the_thread->Join_queue, lock_context );
558 }
559 
567  Thread_Control *the_thread,
568  ISR_lock_Context *lock_context
569 )
570 {
571  _Thread_State_release_critical( the_thread, lock_context );
572  _ISR_lock_ISR_enable( lock_context );
573 }
574 
583 #if defined(RTEMS_DEBUG)
584 RTEMS_INLINE_ROUTINE bool _Thread_State_is_owner(
585  const Thread_Control *the_thread
586 )
587 {
588  return _Thread_queue_Is_lock_owner( &the_thread->Join_queue );
589 }
590 #endif
591 
605  Thread_Control *start_of_path,
606  Thread_queue_Context *queue_context
607 );
608 
625  Thread_Control *the_thread,
626  Priority_Node *priority_node,
627  Thread_queue_Context *queue_context
628 );
629 
646  Thread_Control *the_thread,
647  Priority_Node *priority_node,
648  Thread_queue_Context *queue_context
649 );
650 
670  Thread_Control *the_thread,
671  Priority_Node *priority_node,
672  bool prepend_it,
673  Thread_queue_Context *queue_context
674 );
675 
697  Thread_Control *the_thread,
698  Priority_Node *priority_node,
699  Priority_Control new_priority,
700  bool prepend_it,
701  Thread_queue_Context *queue_context
702 )
703 {
704  _Priority_Node_set_priority( priority_node, new_priority );
706  the_thread,
707  priority_node,
708  prepend_it,
709  queue_context
710  );
711 }
712 
726  Thread_Control *the_thread,
727  Priority_Node *victim_node,
728  Priority_Node *replacement_node
729 );
730 
742 void _Thread_Priority_update( Thread_queue_Context *queue_context );
743 
750 #if defined(RTEMS_SMP)
751 void _Thread_Priority_and_sticky_update(
752  Thread_Control *the_thread,
753  int sticky_level_change
754 );
755 #endif
756 
768  Priority_Control left,
769  Priority_Control right
770 )
771 {
772  return left > right;
773 }
774 
785  Priority_Control left,
786  Priority_Control right
787 )
788 {
789  return _Thread_Priority_less_than( left, right ) ? right : left;
790 }
791 
801  Objects_Id id
802 )
803 {
804  uint32_t the_api;
805 
806  the_api = _Objects_Get_API( id );
807 
808  if ( !_Objects_Is_api_valid( the_api ) ) {
809  return NULL;
810  }
811 
812  /*
813  * Threads are always first class :)
814  *
815  * There is no need to validate the object class of the object identifier,
816  * since this will be done by the object get methods.
817  */
818  return _Objects_Information_table[ the_api ][ 1 ];
819 }
820 
830  Objects_Id id,
831  ISR_lock_Context *lock_context
832 );
833 
842  const Thread_Control *thread
843 )
844 {
845 #if defined(RTEMS_SMP)
846  return thread->Scheduler.cpu;
847 #else
848  (void) thread;
849 
850  return _Per_CPU_Get();
851 #endif
852 }
853 
861  Thread_Control *thread,
862  Per_CPU_Control *cpu
863 )
864 {
865 #if defined(RTEMS_SMP)
866  thread->Scheduler.cpu = cpu;
867 #else
868  (void) thread;
869  (void) cpu;
870 #endif
871 }
872 
885  const Thread_Control *the_thread
886 )
887 {
888  return ( the_thread == _Thread_Executing );
889 }
890 
891 #if defined(RTEMS_SMP)
892 
904 RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_on_a_processor(
905  const Thread_Control *the_thread
906 )
907 {
908  return _CPU_Context_Get_is_executing( &the_thread->Registers );
909 }
910 #endif
911 
924  const Thread_Control *the_thread
925 )
926 {
927  return ( the_thread == _Thread_Heir );
928 }
929 
940  Thread_Control *the_thread
941 )
942 {
943  _Thread_Clear_state( the_thread, STATES_BLOCKED );
944 }
945 
961 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
963  const Thread_Control *the_thread
964 )
965 {
966  return ( the_thread == _Thread_Allocated_fp );
967 }
968 #endif
969 
970 /*
971  * If the CPU has hardware floating point, then we must address saving
972  * and restoring it as part of the context switch.
973  *
974  * The second conditional compilation section selects the algorithm used
975  * to context switch between floating point tasks. The deferred algorithm
976  * can be significantly better in a system with few floating point tasks
977  * because it reduces the total number of save and restore FP context
978  * operations. However, this algorithm can not be used on all CPUs due
979  * to unpredictable use of FP registers by some compilers for integer
980  * operations.
981  */
982 
989 {
990 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
991 #if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE )
992  if ( executing->fp_context != NULL )
993  _Context_Save_fp( &executing->fp_context );
994 #endif
995 #endif
996 }
997 
1004 {
1005 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1006 #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
1007  if ( (executing->fp_context != NULL) &&
1008  !_Thread_Is_allocated_fp( executing ) ) {
1009  if ( _Thread_Allocated_fp != NULL )
1011  _Context_Restore_fp( &executing->fp_context );
1012  _Thread_Allocated_fp = executing;
1013  }
1014 #else
1015  if ( executing->fp_context != NULL )
1016  _Context_Restore_fp( &executing->fp_context );
1017 #endif
1018 #endif
1019 }
1020 
1027 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1029 {
1031 }
1032 #endif
1033 
1044 {
1045  return ( _Thread_Dispatch_necessary );
1046 }
1047 
1057  const Thread_Control *the_thread
1058 )
1059 {
1060  return ( the_thread == NULL );
1061 }
1062 
1069 {
1070  /* Idle threads */
1071  uint32_t maximum_internal_threads =
1073 
1074  /* MPCI thread */
1075 #if defined(RTEMS_MULTIPROCESSING)
1076  if ( _System_state_Is_multiprocessing ) {
1077  ++maximum_internal_threads;
1078  }
1079 #endif
1080 
1081  return maximum_internal_threads;
1082 }
1083 
1091 {
1092  return (Thread_Control *)
1094 }
1095 
1110  Per_CPU_Control *cpu_self
1111 )
1112 {
1113  Thread_Control *heir;
1114 
1115  heir = cpu_self->heir;
1116  cpu_self->dispatch_necessary = false;
1117  cpu_self->executing = heir;
1118 
1119  return heir;
1120 }
1121 
1130  Thread_Control *the_thread,
1131  Per_CPU_Control *cpu
1132 )
1133 {
1134  Timestamp_Control last;
1135  Timestamp_Control ran;
1136 
1137  last = cpu->cpu_usage_timestamp;
1138  _TOD_Get_uptime( &cpu->cpu_usage_timestamp );
1139  _Timestamp_Subtract( &last, &cpu->cpu_usage_timestamp, &ran );
1140  _Timestamp_Add_to( &the_thread->cpu_time_used, &ran );
1141 }
1142 
1150 #if defined( RTEMS_SMP )
1151 RTEMS_INLINE_ROUTINE void _Thread_Dispatch_update_heir(
1152  Per_CPU_Control *cpu_self,
1153  Per_CPU_Control *cpu_for_heir,
1154  Thread_Control *heir
1155 )
1156 {
1157  _Thread_Update_CPU_time_used( cpu_for_heir->heir, cpu_for_heir );
1158 
1159  cpu_for_heir->heir = heir;
1160 
1161  _Thread_Dispatch_request( cpu_self, cpu_for_heir );
1162 }
1163 #endif
1164 
1173  Thread_Control *the_thread,
1174  Timestamp_Control *cpu_time_used
1175 );
1176 
1183  Thread_Action_control *action_control
1184 )
1185 {
1186  _Chain_Initialize_empty( &action_control->Chain );
1187 }
1188 
1195  Thread_Action *action
1196 )
1197 {
1198  _Chain_Set_off_chain( &action->Node );
1199 }
1200 
1209  Thread_Control *the_thread,
1210  Thread_Action *action,
1211  Thread_Action_handler handler
1212 )
1213 {
1214  Per_CPU_Control *cpu_of_thread;
1215 
1216  _Assert( _Thread_State_is_owner( the_thread ) );
1217 
1218  cpu_of_thread = _Thread_Get_CPU( the_thread );
1219 
1220  action->handler = handler;
1221 
1222  _Thread_Dispatch_request( _Per_CPU_Get(), cpu_of_thread );
1223 
1225  &the_thread->Post_switch_actions.Chain,
1226  &action->Node
1227  );
1228 }
1229 
1239  Thread_Life_state life_state
1240 )
1241 {
1242  return ( life_state & THREAD_LIFE_RESTARTING ) != 0;
1243 }
1244 
1254  Thread_Life_state life_state
1255 )
1256 {
1257  return ( life_state & THREAD_LIFE_TERMINATING ) != 0;
1258 }
1259 
1269  Thread_Life_state life_state
1270 )
1271 {
1272  return ( life_state
1273  & ( THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED ) ) == 0;
1274 }
1275 
1285  Thread_Life_state life_state
1286 )
1287 {
1288  return ( life_state
1289  & ( THREAD_LIFE_RESTARTING | THREAD_LIFE_TERMINATING ) ) != 0;
1290 }
1291 
1301  const Thread_Control *the_thread
1302 )
1303 {
1304  _Assert( _Thread_State_is_owner( the_thread ) );
1305  return ( the_thread->Life.state & THREAD_LIFE_DETACHED ) == 0;
1306 }
1307 
1314  Thread_Control *the_thread
1315 )
1316 {
1317 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1318  ++the_thread->resource_count;
1319 #else
1320  (void) the_thread;
1321 #endif
1322 }
1323 
1330  Thread_Control *the_thread
1331 )
1332 {
1333 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1334  --the_thread->resource_count;
1335 #else
1336  (void) the_thread;
1337 #endif
1338 }
1339 
1340 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1341 
1352 RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources(
1353  const Thread_Control *the_thread
1354 )
1355 {
1356  return the_thread->resource_count != 0;
1357 }
1358 #endif
1359 
1360 #if defined(RTEMS_SMP)
1361 
1368 RTEMS_INLINE_ROUTINE void _Thread_Scheduler_cancel_need_for_help(
1369  Thread_Control *the_thread,
1370  Per_CPU_Control *cpu
1371 )
1372 {
1373  ISR_lock_Context lock_context;
1374 
1375  _Per_CPU_Acquire( cpu, &lock_context );
1376 
1377  if ( !_Chain_Is_node_off_chain( &the_thread->Scheduler.Help_node ) ) {
1378  _Chain_Extract_unprotected( &the_thread->Scheduler.Help_node );
1379  _Chain_Set_off_chain( &the_thread->Scheduler.Help_node );
1380  }
1381 
1382  _Per_CPU_Release( cpu, &lock_context );
1383 }
1384 #endif
1385 
1394  const Thread_Control *the_thread
1395 )
1396 {
1397 #if defined(RTEMS_SMP)
1398  return the_thread->Scheduler.home_scheduler;
1399 #else
1400  (void) the_thread;
1401  return &_Scheduler_Table[ 0 ];
1402 #endif
1403 }
1404 
1413  const Thread_Control *the_thread
1414 )
1415 {
1416 #if defined(RTEMS_SMP)
1417  _Assert( !_Chain_Is_empty( &the_thread->Scheduler.Wait_nodes ) );
1418  return SCHEDULER_NODE_OF_THREAD_WAIT_NODE(
1419  _Chain_First( &the_thread->Scheduler.Wait_nodes )
1420  );
1421 #else
1422  return the_thread->Scheduler.nodes;
1423 #endif
1424 }
1425 
1435  const Thread_Control *the_thread,
1436  size_t scheduler_index
1437 )
1438 {
1439 #if defined(RTEMS_SMP)
1440  return (Scheduler_Node *)
1441  ( (uintptr_t) the_thread->Scheduler.nodes
1442  + scheduler_index * _Scheduler_Node_size );
1443 #else
1444  _Assert( scheduler_index == 0 );
1445  (void) scheduler_index;
1446  return the_thread->Scheduler.nodes;
1447 #endif
1448 }
1449 
1450 #if defined(RTEMS_SMP)
1451 
1457 RTEMS_INLINE_ROUTINE void _Thread_Scheduler_acquire_critical(
1458  Thread_Control *the_thread,
1459  ISR_lock_Context *lock_context
1460 )
1461 {
1462  _ISR_lock_Acquire( &the_thread->Scheduler.Lock, lock_context );
1463 }
1464 
1471 RTEMS_INLINE_ROUTINE void _Thread_Scheduler_release_critical(
1472  Thread_Control *the_thread,
1473  ISR_lock_Context *lock_context
1474 )
1475 {
1476  _ISR_lock_Release( &the_thread->Scheduler.Lock, lock_context );
1477 }
1478 
1484 void _Thread_Scheduler_process_requests( Thread_Control *the_thread );
1485 
1493 RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_request(
1494  Thread_Control *the_thread,
1495  Scheduler_Node *scheduler_node,
1496  Scheduler_Node_request request
1497 )
1498 {
1499  ISR_lock_Context lock_context;
1500  Scheduler_Node_request current_request;
1501 
1502  _Thread_Scheduler_acquire_critical( the_thread, &lock_context );
1503 
1504  current_request = scheduler_node->Thread.request;
1505 
1506  if ( current_request == SCHEDULER_NODE_REQUEST_NOT_PENDING ) {
1507  _Assert(
1508  request == SCHEDULER_NODE_REQUEST_ADD
1509  || request == SCHEDULER_NODE_REQUEST_REMOVE
1510  );
1511  _Assert( scheduler_node->Thread.next_request == NULL );
1512  scheduler_node->Thread.next_request = the_thread->Scheduler.requests;
1513  the_thread->Scheduler.requests = scheduler_node;
1514  } else if ( current_request != SCHEDULER_NODE_REQUEST_NOTHING ) {
1515  _Assert(
1516  ( current_request == SCHEDULER_NODE_REQUEST_ADD
1517  && request == SCHEDULER_NODE_REQUEST_REMOVE )
1518  || ( current_request == SCHEDULER_NODE_REQUEST_REMOVE
1519  && request == SCHEDULER_NODE_REQUEST_ADD )
1520  );
1521  request = SCHEDULER_NODE_REQUEST_NOTHING;
1522  }
1523 
1524  scheduler_node->Thread.request = request;
1525 
1526  _Thread_Scheduler_release_critical( the_thread, &lock_context );
1527 }
1528 
1536 RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_wait_node(
1537  Thread_Control *the_thread,
1538  Scheduler_Node *scheduler_node
1539 )
1540 {
1542  &the_thread->Scheduler.Wait_nodes,
1543  &scheduler_node->Thread.Wait_node
1544  );
1545  _Thread_Scheduler_add_request(
1546  the_thread,
1547  scheduler_node,
1548  SCHEDULER_NODE_REQUEST_ADD
1549  );
1550 }
1551 
1559 RTEMS_INLINE_ROUTINE void _Thread_Scheduler_remove_wait_node(
1560  Thread_Control *the_thread,
1561  Scheduler_Node *scheduler_node
1562 )
1563 {
1564  _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
1565  _Thread_Scheduler_add_request(
1566  the_thread,
1567  scheduler_node,
1568  SCHEDULER_NODE_REQUEST_REMOVE
1569  );
1570 }
1571 #endif
1572 
1585  const Thread_Control *the_thread
1586 )
1587 {
1588  Scheduler_Node *scheduler_node;
1589 
1590  scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
1591  return _Priority_Get_priority( &scheduler_node->Wait.Priority );
1592 }
1593 
1602  const Thread_Control *the_thread
1603 )
1604 {
1605  return SCHEDULER_PRIORITY_UNMAP( _Thread_Get_priority( the_thread ) );
1606 }
1607 
1616  const Thread_Control *the_thread
1617 )
1618 {
1619  return SCHEDULER_PRIORITY_UNMAP( the_thread->Real_priority.priority );
1620 }
1621 
1633  Thread_Control *the_thread,
1634  ISR_lock_Context *lock_context
1635 )
1636 {
1637  _ISR_lock_Acquire( &the_thread->Wait.Lock.Default, lock_context );
1638 }
1639 
1652  ISR_lock_Context *lock_context
1653 )
1654 {
1655  Thread_Control *executing;
1656 
1657  _ISR_lock_ISR_disable( lock_context );
1658  executing = _Thread_Executing;
1659  _Thread_Wait_acquire_default_critical( executing, lock_context );
1660 
1661  return executing;
1662 }
1663 
1674  Thread_Control *the_thread,
1675  ISR_lock_Context *lock_context
1676 )
1677 {
1678  _ISR_lock_ISR_disable( lock_context );
1679  _Thread_Wait_acquire_default_critical( the_thread, lock_context );
1680 }
1681 
1693  Thread_Control *the_thread,
1694  ISR_lock_Context *lock_context
1695 )
1696 {
1697  _ISR_lock_Release( &the_thread->Wait.Lock.Default, lock_context );
1698 }
1699 
1709  Thread_Control *the_thread,
1710  ISR_lock_Context *lock_context
1711 )
1712 {
1713  _Thread_Wait_release_default_critical( the_thread, lock_context );
1714  _ISR_lock_ISR_enable( lock_context );
1715 }
1716 
1717 #if defined(RTEMS_SMP)
1718 #define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \
1719  RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node )
1720 
1727 RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request_locked(
1728  Thread_Control *the_thread,
1729  Thread_queue_Lock_context *queue_lock_context
1730 )
1731 {
1732  Chain_Node *first;
1733 
1734  _Chain_Extract_unprotected( &queue_lock_context->Wait.Gate.Node );
1735  first = _Chain_First( &the_thread->Wait.Lock.Pending_requests );
1736 
1737  if ( first != _Chain_Tail( &the_thread->Wait.Lock.Pending_requests ) ) {
1738  _Thread_queue_Gate_open( (Thread_queue_Gate *) first );
1739  }
1740 }
1741 
1748 RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_queue_critical(
1749  Thread_queue_Queue *queue,
1750  Thread_queue_Lock_context *queue_lock_context
1751 )
1752 {
1753  _Thread_queue_Queue_acquire_critical(
1754  queue,
1755  &_Thread_Executing->Potpourri_stats,
1756  &queue_lock_context->Lock_context
1757  );
1758 }
1759 
1766 RTEMS_INLINE_ROUTINE void _Thread_Wait_release_queue_critical(
1767  Thread_queue_Queue *queue,
1768  Thread_queue_Lock_context *queue_lock_context
1769 )
1770 {
1772  queue,
1773  &queue_lock_context->Lock_context
1774  );
1775 }
1776 #endif
1777 
1787  Thread_Control *the_thread,
1788  Thread_queue_Context *queue_context
1789 )
1790 {
1791 #if defined(RTEMS_SMP)
1792  Thread_queue_Queue *queue;
1793 
1795  the_thread,
1796  &queue_context->Lock_context.Lock_context
1797  );
1798 
1799  queue = the_thread->Wait.queue;
1800  queue_context->Lock_context.Wait.queue = queue;
1801 
1802  if ( queue != NULL ) {
1803  _Thread_queue_Gate_add(
1804  &the_thread->Wait.Lock.Pending_requests,
1805  &queue_context->Lock_context.Wait.Gate
1806  );
1808  the_thread,
1809  &queue_context->Lock_context.Lock_context
1810  );
1811  _Thread_Wait_acquire_queue_critical( queue, &queue_context->Lock_context );
1812 
1813  if ( queue_context->Lock_context.Wait.queue == NULL ) {
1814  _Thread_Wait_release_queue_critical(
1815  queue,
1816  &queue_context->Lock_context
1817  );
1819  the_thread,
1820  &queue_context->Lock_context.Lock_context
1821  );
1822  _Thread_Wait_remove_request_locked(
1823  the_thread,
1824  &queue_context->Lock_context
1825  );
1826  _Assert( the_thread->Wait.queue == NULL );
1827  }
1828  }
1829 #else
1830  (void) the_thread;
1831  (void) queue_context;
1832 #endif
1833 }
1834 
1843  Thread_Control *the_thread,
1844  Thread_queue_Context *queue_context
1845 )
1846 {
1847  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
1848  _Thread_Wait_acquire_critical( the_thread, queue_context );
1849 }
1850 
1862  Thread_Control *the_thread,
1863  Thread_queue_Context *queue_context
1864 )
1865 {
1866 #if defined(RTEMS_SMP)
1867  Thread_queue_Queue *queue;
1868 
1869  queue = queue_context->Lock_context.Wait.queue;
1870 
1871  if ( queue != NULL ) {
1872  _Thread_Wait_release_queue_critical(
1873  queue, &queue_context->Lock_context
1874  );
1876  the_thread,
1877  &queue_context->Lock_context.Lock_context
1878  );
1879  _Thread_Wait_remove_request_locked(
1880  the_thread,
1881  &queue_context->Lock_context
1882  );
1883  }
1884 
1886  the_thread,
1887  &queue_context->Lock_context.Lock_context
1888  );
1889 #else
1890  (void) the_thread;
1891  (void) queue_context;
1892 #endif
1893 }
1894 
1904  Thread_Control *the_thread,
1905  Thread_queue_Context *queue_context
1906 )
1907 {
1908  _Thread_Wait_release_critical( the_thread, queue_context );
1909  _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
1910 }
1911 
1927  Thread_Control *the_thread,
1928  Thread_queue_Queue *queue
1929 )
1930 {
1931  ISR_lock_Context lock_context;
1932 
1933  _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
1934 
1935  _Assert( the_thread->Wait.queue == NULL );
1936 
1937 #if defined(RTEMS_SMP)
1938  _Chain_Initialize_empty( &the_thread->Wait.Lock.Pending_requests );
1939  _Chain_Initialize_node( &the_thread->Wait.Lock.Tranquilizer.Node );
1940  _Thread_queue_Gate_close( &the_thread->Wait.Lock.Tranquilizer );
1941 #endif
1942 
1943  the_thread->Wait.queue = queue;
1944 
1945  _Thread_Wait_release_default_critical( the_thread, &lock_context );
1946 }
1947 
1956  Thread_Control *the_thread,
1957  const Thread_queue_Operations *operations
1958 )
1959 {
1960  the_thread->Wait.operations = operations;
1961 }
1962 
1975  Thread_Control *the_thread,
1976  Thread_queue_Lock_context *queue_lock_context
1977 )
1978 {
1979 #if defined(RTEMS_SMP)
1980  ISR_lock_Context lock_context;
1981 
1982  _Thread_Wait_acquire_default( the_thread, &lock_context );
1983  _Thread_Wait_remove_request_locked( the_thread, queue_lock_context );
1984  _Thread_Wait_release_default( the_thread, &lock_context );
1985 #else
1986  (void) the_thread;
1987  (void) queue_lock_context;
1988 #endif
1989 }
1990 
2004  Thread_Control *the_thread
2005 )
2006 {
2007 #if defined(RTEMS_SMP)
2008  ISR_lock_Context lock_context;
2009  Chain_Node *node;
2010  const Chain_Node *tail;
2011 
2012  _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2013 
2014  node = _Chain_First( &the_thread->Wait.Lock.Pending_requests );
2015  tail = _Chain_Immutable_tail( &the_thread->Wait.Lock.Pending_requests );
2016 
2017  if ( node != tail ) {
2018  do {
2019  Thread_queue_Context *queue_context;
2020 
2021  queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
2022  queue_context->Lock_context.Wait.queue = NULL;
2023 
2024  node = _Chain_Next( node );
2025  } while ( node != tail );
2026 
2027  _Thread_queue_Gate_add(
2028  &the_thread->Wait.Lock.Pending_requests,
2029  &the_thread->Wait.Lock.Tranquilizer
2030  );
2031  } else {
2032  _Thread_queue_Gate_open( &the_thread->Wait.Lock.Tranquilizer );
2033  }
2034 #endif
2035 
2036  the_thread->Wait.queue = NULL;
2037  the_thread->Wait.operations = &_Thread_queue_Operations_default;
2038 
2039 #if defined(RTEMS_SMP)
2040  _Thread_Wait_release_default_critical( the_thread, &lock_context );
2041 #endif
2042 }
2043 
2063  Thread_Control *the_thread
2064 )
2065 {
2066 #if defined(RTEMS_SMP)
2067  _Thread_queue_Gate_wait( &the_thread->Wait.Lock.Tranquilizer );
2068 #else
2069  (void) the_thread;
2070 #endif
2071 }
2072 
2081  Thread_Control *the_thread,
2082  Thread_queue_Context *queue_context
2083 )
2084 {
2085  Thread_queue_Queue *queue;
2086 
2087  queue = the_thread->Wait.queue;
2088 
2089 #if defined(RTEMS_SMP)
2090  if ( queue != NULL ) {
2091  _Assert( queue_context->Lock_context.Wait.queue == queue );
2092 #endif
2093 
2094  ( *the_thread->Wait.operations->extract )(
2095  queue,
2096  the_thread,
2097  queue_context
2098  );
2099  _Thread_Wait_restore_default( the_thread );
2100 
2101 #if defined(RTEMS_SMP)
2102  _Assert( queue_context->Lock_context.Wait.queue == NULL );
2103  queue_context->Lock_context.Wait.queue = queue;
2104  }
2105 #endif
2106 }
2107 
2111 #define THREAD_WAIT_FLAGS_INITIAL 0x0U
2112 
2116 #define THREAD_WAIT_STATE_MASK 0xffU
2117 
2125 #define THREAD_WAIT_STATE_INTEND_TO_BLOCK 0x1U
2126 
2130 #define THREAD_WAIT_STATE_BLOCKED 0x2U
2131 
2137 #define THREAD_WAIT_STATE_READY_AGAIN 0x4U
2138 
2142 #define THREAD_WAIT_CLASS_MASK 0xff00U
2143 
2147 #define THREAD_WAIT_CLASS_EVENT 0x100U
2148 
2152 #define THREAD_WAIT_CLASS_SYSTEM_EVENT 0x200U
2153 
2157 #define THREAD_WAIT_CLASS_OBJECT 0x400U
2158 
2162 #define THREAD_WAIT_CLASS_PERIOD 0x800U
2163 
2171  Thread_Control *the_thread,
2172  Thread_Wait_flags flags
2173 )
2174 {
2175 #if defined(RTEMS_SMP)
2176  _Atomic_Store_uint( &the_thread->Wait.flags, flags, ATOMIC_ORDER_RELAXED );
2177 #else
2178  the_thread->Wait.flags = flags;
2179 #endif
2180 }
2181 
2190  const Thread_Control *the_thread
2191 )
2192 {
2193 #if defined(RTEMS_SMP)
2194  return _Atomic_Load_uint( &the_thread->Wait.flags, ATOMIC_ORDER_RELAXED );
2195 #else
2196  return the_thread->Wait.flags;
2197 #endif
2198 }
2199 
2208  const Thread_Control *the_thread
2209 )
2210 {
2211 #if defined(RTEMS_SMP)
2212  return _Atomic_Load_uint( &the_thread->Wait.flags, ATOMIC_ORDER_ACQUIRE );
2213 #else
2214  return the_thread->Wait.flags;
2215 #endif
2216 }
2217 
2235  Thread_Control *the_thread,
2236  Thread_Wait_flags expected_flags,
2237  Thread_Wait_flags desired_flags
2238 )
2239 {
2240  _Assert( _ISR_Get_level() != 0 );
2241 
2242 #if defined(RTEMS_SMP)
2243  return _Atomic_Compare_exchange_uint(
2244  &the_thread->Wait.flags,
2245  &expected_flags,
2246  desired_flags,
2247  ATOMIC_ORDER_RELEASE,
2248  ATOMIC_ORDER_RELAXED
2249  );
2250 #else
2251  bool success = ( the_thread->Wait.flags == expected_flags );
2252 
2253  if ( success ) {
2254  the_thread->Wait.flags = desired_flags;
2255  }
2256 
2257  return success;
2258 #endif
2259 }
2260 
2275  Thread_Control *the_thread,
2276  Thread_Wait_flags expected_flags,
2277  Thread_Wait_flags desired_flags
2278 )
2279 {
2280 #if defined(RTEMS_SMP)
2281  return _Atomic_Compare_exchange_uint(
2282  &the_thread->Wait.flags,
2283  &expected_flags,
2284  desired_flags,
2285  ATOMIC_ORDER_ACQUIRE,
2286  ATOMIC_ORDER_ACQUIRE
2287  );
2288 #else
2289  bool success;
2290  ISR_Level level;
2291 
2292  _ISR_Local_disable( level );
2293 
2295  the_thread,
2296  expected_flags,
2297  desired_flags
2298  );
2299 
2300  _ISR_Local_enable( level );
2301  return success;
2302 #endif
2303 }
2304 
2321 Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread );
2322 
2329  const Thread_Control *the_thread
2330 )
2331 {
2332  return (Status_Control) the_thread->Wait.return_code;
2333 }
2334 
2347 void _Thread_Continue( Thread_Control *the_thread, Status_Control status );
2348 
2354 void _Thread_Timeout( Watchdog_Control *the_watchdog );
2355 
2363  Thread_Timer_information *timer,
2364  Per_CPU_Control *cpu
2365 )
2366 {
2367  _ISR_lock_Initialize( &timer->Lock, "Thread Timer" );
2368  timer->header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_TICKS ];
2369  _Watchdog_Preinitialize( &timer->Watchdog, cpu );
2370 }
2371 
2380  Thread_Control *the_thread,
2381  Per_CPU_Control *cpu,
2382  Watchdog_Interval ticks
2383 )
2384 {
2385  ISR_lock_Context lock_context;
2386 
2387  _ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
2388 
2389  the_thread->Timer.header =
2391  the_thread->Timer.Watchdog.routine = _Thread_Timeout;
2392  _Watchdog_Per_CPU_insert_ticks( &the_thread->Timer.Watchdog, cpu, ticks );
2393 
2394  _ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
2395 }
2396 
2406  Thread_Control *the_thread,
2407  Per_CPU_Control *cpu,
2409  uint64_t expire
2410 )
2411 {
2412  ISR_lock_Context lock_context;
2413  Watchdog_Header *header;
2414 
2415  _ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
2416 
2417  header = &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_REALTIME ];
2418  the_thread->Timer.header = header;
2419  the_thread->Timer.Watchdog.routine = routine;
2420  _Watchdog_Per_CPU_insert( &the_thread->Timer.Watchdog, cpu, header, expire );
2421 
2422  _ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
2423 }
2424 
2431 {
2432  ISR_lock_Context lock_context;
2433 
2434  _ISR_lock_ISR_disable_and_acquire( &the_thread->Timer.Lock, &lock_context );
2435 
2437  &the_thread->Timer.Watchdog,
2438 #if defined(RTEMS_SMP)
2439  the_thread->Timer.Watchdog.cpu,
2440 #else
2441  _Per_CPU_Get(),
2442 #endif
2443  the_thread->Timer.header
2444  );
2445 
2446  _ISR_lock_Release_and_ISR_enable( &the_thread->Timer.Lock, &lock_context );
2447 }
2448 
2457  Thread_Control *the_thread,
2458  Thread_queue_Queue *queue
2459 )
2460 {
2461  _Thread_Wait_tranquilize( the_thread );
2462  _Thread_Timer_remove( the_thread );
2463 
2464 #if defined(RTEMS_MULTIPROCESSING)
2465  if ( _Objects_Is_local_id( the_thread->Object.id ) ) {
2466  _Thread_Unblock( the_thread );
2467  } else {
2468  _Thread_queue_Unblock_proxy( queue, the_thread );
2469  }
2470 #else
2471  (void) queue;
2472  _Thread_Unblock( the_thread );
2473 #endif
2474 }
2475 
2485 Status_Control _Thread_Set_name(
2486  Thread_Control *the_thread,
2487  const char *name
2488 );
2489 
2499 size_t _Thread_Get_name(
2500  const Thread_Control *the_thread,
2501  char *buffer,
2502  size_t buffer_size
2503 );
2504 
2505 #if defined(RTEMS_SMP)
2506 #define THREAD_PIN_STEP 2
2507 
2508 #define THREAD_PIN_PREEMPTION 1
2509 
2516 void _Thread_Do_unpin(
2517  Thread_Control *executing,
2518  Per_CPU_Control *cpu_self
2519 );
2520 #endif
2521 
2528 {
2529 #if defined(RTEMS_SMP)
2530  _Assert( executing == _Thread_Executing );
2531 
2532  executing->Scheduler.pin_level += THREAD_PIN_STEP;
2533 #else
2534  (void) executing;
2535 #endif
2536 }
2537 
2545  Thread_Control *executing,
2546  Per_CPU_Control *cpu_self
2547 )
2548 {
2549 #if defined(RTEMS_SMP)
2550  unsigned int pin_level;
2551 
2552  _Assert( executing == _Thread_Executing );
2553 
2554  pin_level = executing->Scheduler.pin_level;
2555  _Assert( pin_level > 0 );
2556 
2557  if (
2559  pin_level != ( THREAD_PIN_STEP | THREAD_PIN_PREEMPTION )
2560  )
2561  ) {
2562  executing->Scheduler.pin_level = pin_level - THREAD_PIN_STEP;
2563  } else {
2564  _Thread_Do_unpin( executing, cpu_self );
2565  }
2566 #else
2567  (void) executing;
2568  (void) cpu_self;
2569 #endif
2570 }
2571 
2574 #ifdef __cplusplus
2575 }
2576 #endif
2577 
2578 #if defined(RTEMS_MULTIPROCESSING)
2579 #include <rtems/score/threadmp.h>
2580 #endif
2581 
2582 #endif
2583 /* end of include file */
void _Thread_Yield(Thread_Control *executing)
Yields the currently executing thread.
Definition: threadyield.c:30
RTEMS_INLINE_ROUTINE 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
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
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Header *header, uint64_t expire)
Sets the watchdog's cpu and inserts it with the given expiration time in the scheduled watchdogs.
Definition: watchdogimpl.h:625
RTEMS_INLINE_ROUTINE 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:2456
RTEMS_INLINE_ROUTINE 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:1632
Definition: chain.h:68
Watchdog_Service_routine(* Watchdog_Service_routine_entry)(Watchdog_Control *)
Pointer to a watchdog service routine.
Definition: watchdog.h:66
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_request(Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_target)
Requests a thread dispatch on the target processor.
Definition: threaddispatch.h:235
RTEMS_INLINE_ROUTINE 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:1861
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)
Updates the used cpu time for the heir and dispatches a new heir.
Definition: threadgetcputimeused.c:31
RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default(Thread_Control *the_thread)
Restores the default thread wait queue and operations.
Definition: threadimpl.h:2003
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
Definition: chainimpl.h:558
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_restarting(Thread_Life_state life_state)
Checks if the thread life state is restarting.
Definition: threadimpl.h:1238
Timestamp_Control cpu_time_used
Definition: thread.h:827
Thread_CPU_budget_algorithms budget_algorithm
The thread's budget algorithm.
Definition: threadimpl.h:159
RTEMS_INLINE_ROUTINE Objects_Control * _Objects_Allocate_unprotected(Objects_Information *information)
Allocates an object without locking the allocator mutex.
Definition: objectimpl.h:874
Thread_Life_state state
The current thread life state.
Definition: thread.h:700
#define _Context_Save_fp(_fp)
Save floating point context area.
Definition: context.h:153
const Thread_queue_Operations * operations
The current thread queue operations.
Definition: thread.h:498
Definition: deflate.c:115
int64_t Timestamp_Control
Definition: timestamp.h:57
RTEMS_INLINE_ROUTINE void _Chain_Initialize_node(Chain_Node *the_node)
Initializes a chain node.
Definition: chainimpl.h:122
RTEMS_INLINE_ROUTINE 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:2234
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Tail(Chain_Control *the_chain)
Returns pointer to chain tail.
Definition: chainimpl.h:227
RTEMS_INLINE_ROUTINE 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:2328
Definition: threadq.h:125
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Next(const Chain_Node *the_node)
Returns pointer to the next node from this node.
Definition: chainimpl.h:327
#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.
Definition: threadrestart.c:509
RTEMS_INLINE_ROUTINE bool _Objects_Is_local_id(Objects_Id id RTEMS_UNUSED)
Checks if the id is of a local object.
Definition: objectimpl.h:584
RTEMS_INLINE_ROUTINE 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
void * allocated_stack
The address of the allocated stack area or NULL.
Definition: threadimpl.h:149
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
Thread_Life_state
Thread life states.
Definition: thread.h:679
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:263
Watchdog_Header Header[PER_CPU_WATCHDOG_COUNT]
Header for watchdogs.
Definition: percpu.h:474
RTEMS_INLINE_ROUTINE void _Thread_Set_CPU(Thread_Control *thread, Per_CPU_Control *cpu)
Sets the cpu of the thread's scheduler.
Definition: threadimpl.h:860
RTEMS_INLINE_ROUTINE 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:1673
Thread_Wait_information Wait
Definition: thread.h:774
#define _ISR_Local_disable(_level)
Disables interrupts on this processor.
Definition: isrlevel.h:57
Thread queue context for the thread queue methods.
Definition: threadq.h:198
The priority node to build up a priority aggregation.
Definition: priority.h:98
RTEMS_INLINE_ROUTINE bool _Thread_Priority_less_than(Priority_Control left, Priority_Control right)
Updates the priority of the thread and changes it sticky level.
Definition: threadimpl.h:767
struct _Thread_Control * executing
This is the thread executing on this processor.
Definition: percpu.h:420
Thread entry information.
Definition: thread.h:136
RTEMS_INLINE_ROUTINE 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:1974
RTEMS_INLINE_ROUTINE void _Thread_Resource_count_decrement(Thread_Control *the_thread)
Decrements the thread's resource count.
Definition: threadimpl.h:1329
void _Thread_Kill_zombies(void)
Kills all zombie threads in the system.
Definition: threadrestart.c:216
Data Related to the Management of Processor Interrupt Levels.
Inlined Routines in the Watchdog Handler.
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
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.
Definition: threadrestart.c:649
RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp(const Thread_Control *the_thread)
Checks if the floating point context of the thread is currently loaded in the floating point unit.
Definition: threadimpl.h:962
void _Thread_Exit(Thread_Control *executing, Thread_Life_state set, void *exit_value)
Exits the currently executing thread.
Definition: threadrestart.c:532
RTEMS_INLINE_ROUTINE void _Chain_Set_off_chain(Chain_Node *node)
Sets off chain.
Definition: chainimpl.h:104
The control block used to manage each watchdog timer.
Definition: watchdog.h:90
#define STATES_BLOCKED
Definition: statesimpl.h:135
RTEMS_INLINE_ROUTINE 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:1651
RTEMS_INLINE_ROUTINE void _Thread_Unblock(Thread_Control *the_thread)
Unblocks the thread.
Definition: threadimpl.h:939
void _Thread_Entry_adaptor_pointer(Thread_Control *executing)
Calls the start kinds pointer entry of the thread.
Definition: threadentryadaptorpointer.c:21
RTEMS_INLINE_ROUTINE Thread_Control * _Thread_Internal_allocate(void)
Allocates an internal thread and returns it.
Definition: threadimpl.h:1090
RTEMS_INLINE_ROUTINE void _Thread_Pin(Thread_Control *executing)
Pin the executing thread.
Definition: threadimpl.h:2527
RTEMS_INLINE_ROUTINE void _Chain_Initialize_empty(Chain_Control *the_chain)
Initializes this chain as empty.
Definition: chainimpl.h:505
uint32_t return_code
Definition: thread.h:420
void * rtems_ada_self
#define RTEMS_NO_RETURN
Definition: basedefs.h:102
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_terminating(Thread_Life_state life_state)
Checks if the thread life state is terminating.
Definition: threadimpl.h:1253
RTEMS_INLINE_ROUTINE void _Thread_Action_initialize(Thread_Action *action)
Initializes the Thread action.
Definition: threadimpl.h:1194
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:419
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:771
Information required to manage a thread timer.
Definition: thread.h:506
RTEMS_INLINE_ROUTINE void _Thread_Wait_tranquilize(Thread_Control *the_thread)
Tranquilizes the thread after a wait on a thread queue.
Definition: threadimpl.h:2062
Thread_queue_Queue * queue
The current thread queue.
Definition: thread.h:489
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_change_allowed(Thread_Life_state life_state)
Checks if the thread life state allos life change.
Definition: threadimpl.h:1268
Objects_Information Objects
The object information.
Definition: thread.h:1001
RTEMS_INLINE_ROUTINE 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:533
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_priority(const Thread_Control *the_thread)
Returns the unmapped priority of the thread.
Definition: threadimpl.h:1601
Thread_Control * _Thread_Get(Objects_Id id, ISR_lock_Context *lock_context)
Gets a thread by its identifier.
Definition: threadget.c:24
RTEMS_INLINE_ROUTINE 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:1786
RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get_acquire(const Thread_Control *the_thread)
Gets the thread's wait flags according to the ATOMIC_ORDER_ACQUIRE.
Definition: threadimpl.h:2207
RTEMS_INLINE_ROUTINE Scheduler_Node * _Thread_Scheduler_get_node_by_index(const Thread_Control *the_thread, size_t scheduler_index)
Gets the thread's scheduler node by index.
Definition: threadimpl.h:1434
Context_Control_fp * fp_context
Definition: thread.h:842
bool _Thread_Initialize(Thread_Information *information, Thread_Control *the_thread, const Thread_Configuration *config)
Initializes thread.
Definition: threadinitialize.c:29
RTEMS_INLINE_ROUTINE 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:1842
RTEMS_INLINE_ROUTINE 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:1129
Helpers for Manipulating Timestamps.
RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads(void)
Gets the maximum number of internal threads.
Definition: threadimpl.h:1068
#define _ISR_Get_level()
Return current interrupt level.
Definition: isrlevel.h:128
Definition: threadq.h:402
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
RTEMS_INLINE_ROUTINE void _Thread_Save_fp(Thread_Control *executing)
Saves the executing thread's floating point area.
Definition: threadimpl.h:988
RTEMS_INLINE_ROUTINE void _Timestamp_Add_to(Timestamp_Control *_time, const Timestamp_Control *_add)
Adds two timestamps.
Definition: timestampimpl.h:147
Watchdog_Service_routine_entry routine
This field is the function to invoke.
Definition: watchdog.h:114
Objects_Name name
Name of the object for the thread.
Definition: threadimpl.h:169
RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API(Objects_Id id)
Returns the API portion of the ID.
Definition: object.h:255
uint32_t States_Control
Definition: states.h:46
Thread queue operations.
Definition: threadq.h:517
RTEMS_INLINE_ROUTINE 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:784
Information for the Assert Handler.
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.
Definition: threadrestart.c:421
RTEMS_INLINE_ROUTINE void _Thread_Wait_flags_set(Thread_Control *the_thread, Thread_Wait_flags flags)
Sets the thread's wait flags.
Definition: threadimpl.h:2170
RTEMS_INLINE_ROUTINE bool _Chain_Is_empty(const Chain_Control *the_chain)
Checks if the chain is empty.
Definition: chainimpl.h:393
RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_realtime(Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Service_routine_entry routine, uint64_t expire)
Inserts the cpu's watchdog realtime into the thread's timer.
Definition: threadimpl.h:2405
RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp(void)
Deallocates the currently loaded floating point context.
Definition: threadimpl.h:1028
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 ...
Definition: threadchangepriority.c:307
RTEMS_INLINE_ROUTINE 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:1708
RTEMS_INLINE_ROUTINE void _Thread_Resource_count_increment(Thread_Control *the_thread)
Increments the thread's resource count.
Definition: threadimpl.h:1313
void _Thread_Timeout(Watchdog_Control *the_watchdog)
General purpose thread wait timeout.
Definition: threadtimeout.c:83
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_First(const Chain_Control *the_chain)
Returns pointer to chain's first node.
Definition: chainimpl.h:260
RTEMS_INLINE_ROUTINE void _Watchdog_Preinitialize(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu)
Pre-initializes a watchdog.
Definition: watchdogimpl.h:214
RTEMS_INLINE_ROUTINE 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
RTEMS_INLINE_ROUTINE bool _Thread_Is_null(const Thread_Control *the_thread)
Checks if the thread is NULL.
Definition: threadimpl.h:1056
Definition: thread.h:732
Priority_Control priority
The new thread's priority.
Definition: threadimpl.h:154
#define RTEMS_PREDICT_TRUE(_exp)
Returns the value of the specified integral expression and tells the compiler that the predicted valu...
Definition: basedefs.h:374
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:390
Control block to manage thread actions.
Definition: thread.h:665
const struct _Scheduler_Control * scheduler
The scheduler control instance for the thread.
Definition: threadimpl.h:134
Per CPU Core Structure.
Definition: percpu.h:347
RTEMS_INLINE_ROUTINE 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:1903
Objects_Id _Thread_Global_constructor
Object identifier of the global constructor thread.
Definition: threadhandler.c:49
Thread_Life_state _Thread_Set_life_protection(Thread_Life_state state)
Set the thread to life protected.
Definition: threadrestart.c:671
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.
Definition: threadsetstate.c:28
The configuration of a new thread to initialize.
Definition: threadimpl.h:130
The thread object information.
Definition: thread.h:997
Status_Control _Thread_Set_name(Thread_Control *the_thread, const char *name)
Sets the name of the thread.
Definition: threadname.c:17
RTEMS_INLINE_ROUTINE void _Thread_State_release(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context and enables interrupts.
Definition: threadimpl.h:566
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_real_priority(const Thread_Control *the_thread)
Returns the unmapped real priority of the thread.
Definition: threadimpl.h:1615
void _Thread_Start_multitasking(void) RTEMS_NO_RETURN
Starts thread multitasking.
Definition: threadstartmultitasking.c:24
void _Thread_Create_idle(void)
Creates idle thread.
Definition: threadcreateidle.c:93
Thread action.
Definition: thread.h:640
RTEMS_INLINE_ROUTINE 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:1955
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:734
size_t stack_size
The size of the stack area in bytes.
Definition: threadimpl.h:144
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_tail(const Chain_Control *the_chain)
Returns pointer to immutable chain tail.
Definition: chainimpl.h:243
Objects_Id _Thread_Wait_get_id(const Thread_Control *the_thread)
Returns the object identifier of the object containing the current thread wait queue.
Definition: threadwaitgetid.c:21
Thread_queue_Extract_operation extract
Thread queue extract operation.
Definition: threadq.h:535
Thread_CPU_budget_algorithm_callout budget_callout
The thread's initial budget callout.
Definition: threadimpl.h:164
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
Definition: isrlevel.h:74
Constants and Structures Associated with the Manipulation of Objects.
RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary(void)
Checks if dispatching is disabled.
Definition: threadimpl.h:1043
States_Control _Thread_Clear_state(Thread_Control *the_thread, States_Control state)
Clears the specified thread state.
Definition: threadclearstate.c:51
RTEMS_INLINE_ROUTINE void _Thread_Unpin(Thread_Control *executing, Per_CPU_Control *cpu_self)
Unpins the thread.
Definition: threadimpl.h:2544
States_Control current_state
Definition: thread.h:756
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...
Definition: threadchangepriority.c:323
#define SCHEDULER_PRIORITY_UNMAP(priority)
Returns the plain priority value.
Definition: schedulernodeimpl.h:61
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:293
RTEMS_INLINE_ROUTINE 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: threadqimpl.h:747
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_changing(Thread_Life_state life_state)
Checks if the thread life state is life changing.
Definition: threadimpl.h:1284
RTEMS_INLINE_ROUTINE 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:2379
const Scheduler_Control _Scheduler_Table[]
Registered schedulers.
#define _ISR_lock_Release(_lock, _context)
Releases an ISR lock inside an ISR disabled section.
Definition: isrlock.h:316
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
Definition: threadchangepriority.c:339
States_Control _Thread_Set_state(Thread_Control *the_thread, States_Control state)
Sets the specified thread state.
Definition: threadsetstate.c:50
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.
Thread_CPU_budget_algorithms
Definition: thread.h:164
RTEMS_INLINE_ROUTINE 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: threadqimpl.h:665
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.
Definition: threadchangepriority.c:182
RTEMS_INLINE_ROUTINE Per_CPU_Control * _Thread_Get_CPU(const Thread_Control *thread)
Gets the cpu of the thread's scheduler.
Definition: threadimpl.h:841
Time of Day Handler API.
RTEMS_INLINE_ROUTINE bool _Objects_Is_api_valid(uint32_t the_api)
Checks if the api is valid.
Definition: objectimpl.h:549
Inlined Routines Associated with Thread State Information.
RTEMS_INLINE_ROUTINE 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:1692
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
Definition: percpu.h:400
#define _ISR_lock_ISR_disable_and_acquire(_lock, _context)
Acquires an ISR lock.
Definition: isrlock.h:238
RTEMS_INLINE_ROUTINE Objects_Information * _Thread_Get_objects_information(Objects_Id id)
Gets object information for the object id.
Definition: threadimpl.h:800
struct _Thread_Control * heir
This is the heir thread for this processor.
Definition: percpu.h:436
RTEMS_INLINE_ROUTINE void _Timestamp_Subtract(const Timestamp_Control *_start, const Timestamp_Control *_end, Timestamp_Control *_result)
Subtracts two timestamps.
Definition: timestampimpl.h:166
void _Thread_Entry_adaptor_idle(Thread_Control *executing)
Calls the start kinds idle entry of the thread.
Definition: threadentryadaptoridle.c:21
RTEMS_INLINE_ROUTINE void _Chain_Append_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Appends a node (unprotected).
Definition: chainimpl.h:680
RTEMS_INLINE_ROUTINE void _Thread_Restore_fp(Thread_Control *executing)
Restores the executing thread's floating point area.
Definition: threadimpl.h:1003
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.
Definition: threadrestart.c:602
void _Thread_Entry_adaptor_numeric(Thread_Control *executing)
Calls the start kinds numeric entry of the thread.
Definition: threadentryadaptornumeric.c:21
RTEMS_INLINE_ROUTINE bool _Thread_Is_executing(const Thread_Control *the_thread)
Checks if the thread is the currently executing thread.
Definition: threadimpl.h:884
The watchdog header to manage scheduled watchdogs.
Definition: watchdog.h:71
RTEMS_INLINE_ROUTINE const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
Definition: threadimpl.h:1393
States_Control _Thread_Clear_state_locked(Thread_Control *the_thread, States_Control state)
Clears the specified thread state without locking the lock context.
Definition: threadclearstate.c:25
bool is_fp
Indicates whether the thread needs a floating-point area.
Definition: threadimpl.h:179
unsigned context
Definition: tlb.h:108
System State Handler API.
void * stack_area
The starting address of the stack area.
Definition: threadimpl.h:139
RTEMS_INLINE_ROUTINE 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:502
void _Thread_Handler(void)
Wrapper function for all threads.
Definition: threadhandler.c:72
RTEMS_INLINE_ROUTINE bool _Thread_Is_joinable(const Thread_Control *the_thread)
Checks if the thread is joinable.
Definition: threadimpl.h:1300
void(* Thread_CPU_budget_algorithm_callout)(Thread_Control *)
Definition: thread.h:178
Thread_Control * _Thread_Allocated_fp
Definition: threaddispatch.c:35
Thread_queue_Control Join_queue
Thread queue for thread join operations and multi-purpose lock.
Definition: thread.h:753
Scheduler control.
Definition: scheduler.h:269
Scheduler node for per-thread data.
Definition: schedulernode.h:79
RTEMS_INLINE_ROUTINE bool _Thread_Is_heir(const Thread_Control *the_thread)
Checks if the thread is the heir.
Definition: threadimpl.h:923
RTEMS_INLINE_ROUTINE void _Thread_Wait_claim(Thread_Control *the_thread, Thread_queue_Queue *queue)
Claims the thread wait queue.
Definition: threadimpl.h:1926
RTEMS_INLINE_ROUTINE bool _Thread_Is_ready(const Thread_Control *the_thread)
Checks if the thread is ready.
Definition: threadimpl.h:375
bool _Thread_Start(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Initializes thread and executes it.
Definition: threadstart.c:26
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
Definition: isrlock.h:398
RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get(const Thread_Control *the_thread)
Gets the thread's wait flags according to the ATOMIC_ORDER_RELAXED.
Definition: threadimpl.h:2189
Definition: threadimpl.h:345
#define _ISR_lock_Initialize(_lock, _name)
Initializes an ISR lock.
Definition: isrlock.h:185
Thread_Wait_flags flags
This field contains several flags used to control the wait class and state of a thread in case fine-g...
Definition: thread.h:429
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.
Definition: threadchangepriority.c:292
RTEMS_INLINE_ROUTINE bool _States_Is_ready(States_Control the_states)
Checks if the state is ready.
Definition: statesimpl.h:195
bool is_preemptible
Indicates whether the new thread is preemptible.
Definition: threadimpl.h:184
struct Scheduler_Node::@3980 Wait
Thread wait support block.
uint32_t Objects_Id
Definition: object.h:80
void _Thread_Handler_initialization(void)
Initializes thread handler.
Definition: thread.c:59
RTEMS_INLINE_ROUTINE 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
RTEMS_INLINE_ROUTINE Priority_Control _Priority_Get_priority(const Priority_Aggregation *aggregation)
Gets the priority aggregation's priority.
Definition: priorityimpl.h:270
Scheduler_Node * nodes
The scheduler nodes of this thread.
Definition: thread.h:358
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority(const Thread_Control *the_thread)
Returns the priority of the thread.
Definition: threadimpl.h:1584
RTEMS_INLINE_ROUTINE void _Thread_Wait_cancel(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Cancels a thread wait on a thread queue.
Definition: threadimpl.h:2080
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
RTEMS_INLINE_ROUTINE void _Thread_Timer_initialize(Thread_Timer_information *timer, Per_CPU_Control *cpu)
Initializes the thread timer.
Definition: threadimpl.h:2362
RTEMS_INLINE_ROUTINE 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:1109
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:130
RTEMS_INLINE_ROUTINE void _Thread_Action_control_initialize(Thread_Action_control *action_control)
Initializes the control chain of the action control.
Definition: threadimpl.h:1182
RTEMS_INLINE_ROUTINE bool _Chain_Is_node_off_chain(const Chain_Node *node)
Checks if the node is off chain.
Definition: chainimpl.h:142
Index for tick clock per-CPU watchdog header.
Definition: percpu.h:316
Definition: mmu-config.c:40
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.
Definition: threadchangepriority.c:277
Inlined Routines in the Object Handler.
RTEMS_INLINE_ROUTINE 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:696
Multiprocessing Portion of the Thread Package.
void _Thread_Cancel(Thread_Control *the_thread, Thread_Control *executing, void *exit_value)
Cancels the thread.
Definition: threadrestart.c:450
uint32_t isr_level
The thread's initial ISR level.
Definition: threadimpl.h:174
Context_Control Registers
Definition: thread.h:837
Definition: object.h:64
Thread_Information _Thread_Information
The internal thread objects information.
RTEMS_INLINE_ROUTINE 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:1208
RTEMS_INLINE_ROUTINE 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:2274
Thread_Life_control Life
Thread life-cycle control.
Definition: thread.h:859
RTEMS_INLINE_ROUTINE 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:552
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:761
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
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:620
size_t _Thread_Get_name(const Thread_Control *the_thread, char *buffer, size_t buffer_size)
Gets the name of the thread.
Definition: threadname.c:37
#define rtems_configuration_get_maximum_processors()
Returns the configured maximum count of processors.
Definition: config.h:164
RTEMS_INLINE_ROUTINE void _Thread_Timer_remove(Thread_Control *the_thread)
Remove the watchdog timer from the thread.
Definition: threadimpl.h:2430
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_ticks(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Interval ticks)
Sets the watchdog's cpu to the given instance and sets its expiration time to the watchdog expiration...
Definition: watchdogimpl.h:593
struct Per_CPU_Control::@3977 Watchdog
Watchdog state for this processor.
void _Thread_Initialize_information(Thread_Information *information)
Initializes the thread information.
Definition: thread.c:47
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100
RTEMS_INLINE_ROUTINE Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler's home node.
Definition: threadimpl.h:1412
Thread_Timer_information Timer
Definition: thread.h:776
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77
bool _Thread_Restart_other(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.
Definition: threadrestart.c:559
RTEMS_INLINE_ROUTINE void _Thread_State_acquire(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock_context.
Definition: threadimpl.h:516
Objects_Id id
Definition: objectdata.h:43