Lines Matching refs:mutex
6 A mutual exclusion (mutex) is a special binary semaphore used for exclusive access to shared resour…
8 …mutex can be unlocked or locked. When a task holds a mutex, the mutex is locked and the task obtai…
10 … compete for shared resources, the mutex can protect the shared resources via exclusive access. In…
15 …esources are not shared, and can only be accessed exclusively by tasks. A mutex can be used to add…
17 … are accessed by a task, the mutex is locked. Other tasks will be blocked until the mutex is relea…
20 
25 **Table 1** APIs of the mutex module
29 | Creating or deleting a mutex| **LOS_MuxCreate**: creates a mutex.<br>**LOS_MuxDelete**: eeletes a…
30 | Requesting or releasing a mutex| **LOS_MuxPend**: requests a mutex.<br>**LOS_MuxPost**: releases …
35 The typical mutex development process is as follows:
37 1. Call **LOS_MuxCreate** to create a mutex.
39 2. Call **LOS_MuxPend** to request a mutex.
42 …acquires the mutex if the requested mutex is not held by any task or the task holding the mutex is…
43 …mutex if the requested mutex is not occupied. If the mutex is occupied, the task will be blocked a…
44 …mutex if the requested mutex is not occupied. If the mutex is occupied, the task will be blocked a…
46 3. Call **LOS_MuxPost** to release a mutex.
47 …- If tasks are blocked by the specified mutex, the task with a higher priority will be unblocked w…
48 - If no task is blocked by the specified mutex, the mutex is released successfully.
50 4. Call **LOS_MuxDelete** to delete a mutex.
53 …ted. That is, if a task that attempts to apply for a mutex and the task that already holds the mut…
57 …real-time task scheduling and avoid long-time task blocking. Therefore, a mutex must be released a…
59 > - When a mutex is held by a task, the task priority cannot be changed by using APIs such as **LOS…
69 …mutex for the **ExampleMutex** task. Lock task scheduling, and create two tasks **ExampleMutexTask…
71 …which has a higher priority) is scheduled and applies for a mutex. After acquiring the mutex, **Ex…
73 …mutex with a timeout period of 10 ticks. Because the mutex is still held by **ExampleMutexTask2**,…
75 …mutex, and **ExampleMutexTask1** is woken up. **ExampleMutexTask1** acquires the mutex and is exec…
95 printf("task1 try to get mutex, wait 10 ticks.\n");
96 /* Request a mutex. */
99 printf("task1 get mutex g_testMux.\n");
100 /* Release the mutex. This branch is reserved for exceptions. */
107 printf("task1 timeout and try to get mutex, wait forever.\n");
108 /* Request a mutex. */
111 printf("task1 wait forever, get mutex g_testMux.\n");
112 /* Release the mutex. */
114 /* Delete the mutex. */
116 printf("task1 post and delete mutex g_testMux.\n");
126 printf("task2 try to get mutex, wait forever.\n");
127 /* Request a mutex. */
129 printf("task2 get mutex g_testMux and suspend 100 ticks.\n");
135 /* Release the mutex. */
148 /* Create a mutex. */
189 task2 try to get mutex, wait forever.
190 task2 get mutex g_testMux and suspend 100 ticks.
191 task1 try to get mutex, wait 10 ticks.
192 task1 timeout and try to get mutex, wait forever.
194 task1 wait forever, get mutex g_testMux.
195 task1 post and delete mutex g_testMux.