当前位置:网站首页>B_ QuRT_ User_ Guide(16)

B_ QuRT_ User_ Guide(16)

2022-06-11 03:08:00 weixin_ thirty-eight million four hundred and ninety-eight thou

10 All-signals

Threads depend on the occurrence of one or more internal events , Use all signals to synchronize their execution . All signals are stored in a shared object , The following operations are supported .
If one or more signals are set at All-signal In the object , And a thread is All-signal Object to wait for the setting of this particular semaphore set , Then the thread is awakened . If the awakened thread has a higher priority than the current thread , Then context switching will occur .
Different from any signal ,all-signals There is no need to explicitly clear before waiting for the signal again all-signal Any setting signal in the object – The clearing operation is automatically completed by the waiting operation .
One all-signal Object contains 32 A signal , These signals are in a 32 The value of the bit is expressed as 0-31 position . A value 0 Indicates that the signal is set ,1 Indicates that the signal is cleared ( This is the opposite of the definition of any signal ).
Be careful : At any time , At most one thread can wait on a fully signaled object .
Because the clearing of the signal is completed by the waiting operation , So there is no clear operation defined for all signals .
All signal services can be provided through the following QuRT Function access .- qurt_allsignal_destroy()

  • qurt_allsignal_get()
  • qurt_allsignal_init()
  • qurt_allsignal_set() - qurt_allsignal_wait() - data type

10.1 qurt_allsignal_destroy()

10.1.1 Function Documentation

10.1.1.1 void qurt_allsignal_destroy ( qurt_allsignal_t ∗ signal )

Destroy all specified signal objects .
Be careful : When all signal objects are no longer used , It must be destroyed . Failure to do so will result in QuRT Kernel resource leak .
All signal objects cannot be destroyed while still in use . If this happens ,QuRT The behavior of will not be defined .
Related data types
qurt_allsignal_t
Parameters
 Insert picture description here
Return value
None.
Dependency relationship
None.

10.2 qurt_allsignal_get()

10.2.1 Function Documentation

10.2.1.1 sstatic unsigned int qurt_allsignal_get ( qurt_allsignal_t ∗ signal )

from All-signal Object to get the signal value .
Returns the specified all-signal The current signal value of the object .
Related data types
qurt_allsignal_t
Parameters

 Insert picture description here
Return value
None.
Dependency relationship
None.

10.3 qurt_allsignal_init()

10.3.1 Function Documentation

10.3.1.1 void qurt_allsignal_init ( qurt_allsignal_t ∗ signal )

Initialize all signal objects .
All signal objects are initially cleared .
Related data types
qurt_allsignal_t
Parameters
 Insert picture description here
Return value
None.
Dependency relationship
None.

10.4 qurt_allsignal_set()

10.4.1 Function Documentation

10.4.1.1 void qurt_allsignal_set ( qurt_allsignal_t ∗ signal, unsigned int mask )

Sets the signal in the specified full signal object .
The signal is 32 The bit mask value is represented as the... Th 0 To 31 position . The mask bit value is 1 Indicates that the signal must be set ,0 Indicates that the signal is not set .
Related data types
qurt_allsignal_t
Parameters
 Insert picture description here
Return value
None.
Dependency relationship
None.

10.5 qurt_allsignal_wait()

10.5.1 Function Documentation

10.5.1.1 void qurt_allsignal_wait ( qurt_allsignal_t ∗ signal, unsigned int mask )

Wait on all signal objects .
Pause current thread , Until all specified signals are set . The signal is 32 The bit mask value is represented as the... Th 0 To 31 position . The mask bit value is 1 Indicates that you must wait for a signal ,0 No need to wait .
If a signal is set in a full signal object , And a thread is waiting for the signal on the full signal object , Then the thread will be awakened . If the awakened thread has a higher priority than the current thread , Then context switching will occur .
Different from any signal ,all-signals There is no need to explicitly clear before waiting for the signal again all-signal Any setting signal in the object – The clearing operation is automatically completed by the waiting operation .
Be careful : At any time , At most one thread can be in one all-signal Wait on the object . Because the signal is cleared by wait It's done , So not for all-signals Define the purge operation .
Related data types
qurt_allsignal_t
Parameters
 Insert picture description here
Return value
None.
Dependency relationship
None.

10.6 Data Types

This section describes the data types of full signal service .

  • All signals are in QuRT Is represented as qurt_allsignal_t Object of type .

10.6.1 Data Structure Documentation

10.6.1.1 union qurt_allsignal_t

qurt_signal_t To replace the qurt_allsignal_t. This type definition was added for backward compatibility .

原网站

版权声明
本文为[weixin_ thirty-eight million four hundred and ninety-eight thou]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110238527031.html