[riot-notifications] [RIOT-OS/RIOT] [TRACKING] xtimer/xtimer.c: xtimer_mutex_lock_timeout fix and improvements (#11660)

Gaƫtan Harter notifications at github.com
Fri Jun 28 17:04:38 CEST 2019


cladmi commented on this pull request.



> +{
+    unsigned irqstate = irq_disable();
+    assert(mutex != NULL && thread != NULL);
+    DEBUG("_mutex_remove_thread_from_waiting_queue(): param thread: %"PRIkernel_pid"\n", thread->pid);
+
+    if (mutex->queue.next != MUTEX_LOCKED && mutex->queue.next != NULL) {
+        list_node_t *node = list_remove(&mutex->queue, (list_node_t *)&thread->rq_entry);
+        /* if thread was removed from the list */
+        if (node != NULL) {
+            DEBUG("thread: %"PRIkernel_pid" removed from list\n", (container_of((clist_node_t *)node, thread_t, rq_entry)->pid));
+            if (mutex->queue.next == NULL) {
+                mutex->queue.next = MUTEX_LOCKED;
+            }
+            sched_set_status(thread, STATUS_PENDING);
+            irq_restore(irqstate);
+            thread_yield_higher();

Implementation in the CPU is wrong, this code is correct https://github.com/RIOT-OS/RIOT/pull/11759#issuecomment-506760423

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11660#discussion_r298633339
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190628/32309bd0/attachment.html>


More information about the notifications mailing list