Lines Matching refs:mutex

6mutex) is a special binary semaphore used for exclusive access to shared resources. When a task ho…
8 A mutex has three attributes: protocol attribute, priority upper limit attribute, and type attribut…
12 Do not inherit or protect the priority of the task requesting the mutex.
16mutex. This is the default protocol attribute. When the mutex protocol attribute is set to this va…
20mutex. When the mutex protocol attribute is set to this value: If the priority of the task that re…
22 …The type attribute of a mutex specifies whether to check for deadlocks and whether to support recu…
26mutex, which does not check for deadlocks. If a task repeatedly attempts to hold a mutex, the thre…
30mutex, which is the default attribute. If the type attribute of a mutex is set to this value, a ta…
34mutex is set to this type, an error code will be returned if a task attempts to repeatedly hold th…
39 …esources are not shared, and can only be accessed exclusively by tasks. A mutex can be used to add…
41 … are accessed by a task, the mutex is locked. Other tasks will be blocked until the mutex is relea…
45 ![](figures/mutex-working-mechanism-for-small-systems.png "mutex-working-mechanism-for-small-system…
53 **Table 1** APIs of the mutex module
57 | Initializing or destroying a mutex| - **LOS_MuxInit**: initializes a mutex.<br>- **LOS_MuxDestroy…
58 …g a mutex| - **LOS_MuxLock**: requests a mutex.<br>- **LOS_MuxTrylock**: requests a mutex without …
59 …Verifying a mutex| - **LOS_MuxIsValid**: checks whether the mutex release is valid.<br>- **LOS_Mux…
60mutex attributes| - **LOS_MuxAttrGetType**: obtains the type attribute of a mutex.<br>- **LOS_MuxA…
65 The typical mutex development process is as follows:
67 1. Call **LOS_MuxInit** to initialize a mutex.
69 2. Call **LOS_MuxLock** to request a mutex.
73 …acquires the mutex if the requested mutex is not held by any task or the task holding the mutex is…
75mutex if the requested mutex is not occupied. If the mutex is occupied, the task will be blocked a…
77mutex if the requested mutex is not occupied. If the mutex is occupied, the task will be blocked a…
79 3. Call **LOS_MuxUnlock** to release a mutex.
81 - If tasks are blocked by the specified mutex, the task with a higher priority will be unblocked wh…
83 - If no task is blocked by the specified mutex, the mutex is released successfully.
85 4. Call **LOS_MuxDestroy** to destroy a mutex.
88 …ks cannot lock the same mutex. If a task attempts to lock a mutex held by another task, the task w…
92 …real-time task scheduling and avoid long-time task blocking. Therefore, a mutex must be released a…
101 1. Create the **Example_TaskEntry** task. In this task, create a mutex to lock task scheduling, and…
103 …ng scheduled, **Example_MutexTask2** requests a mutex in permanent block mode. After acquiring the…
105mutex in scheduled block mode, and waits for 10 ticks. Because the mutex is still held by **Exampl…
107 …s the mutex, and then **Example_MutexTask1** is woken up. **Example_MutexTask1** acquires the mute…
130 dprintf("task1 try to get mutex, wait 10 ticks.\n");
131 /* Request a mutex. */
135 dprintf("task1 get mutex g_testMux.\n");
136 /* Release the mutex. */
141 dprintf("task1 timeout and try to get mutex, wait forever.\n");
142 /* Request a mutex. */
145 dprintf("task1 wait forever, get mutex g_testMux.\n");
146 /* Release the mutex. */
148 /* Delete the mutex. */
150 dprintf("task1 post and delete mutex g_testMux.\n");
159 dprintf("task2 try to get mutex, wait forever.\n");
160 /* Request a mutex. */
163 dprintf("task2 get mutex g_testMux and suspend 100 ticks.\n");
169 /* Release the mutex. */
180 /* Initialize the mutex. */
223 task2 try to get mutex, wait forever.
224 task2 get mutex g_testMux and suspend 100 ticks.
225 task1 try to get mutex, wait 10 ticks.
226 task1 timeout and try to get mutex, wait forever.
228 task1 wait forever, get mutex g_testMux.
229 task1 post and delete mutex g_testMux.