Changeset 8a18d5b in mainline for uspace/lib/c/generic/thread/futex.c


Ignore:
Timestamp:
2018-11-11T15:47:39Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
269bc459
Parents:
0b5203b
git-author:
Jakub Jermar <jakub@…> (2018-11-10 16:22:29)
git-committer:
Jakub Jermar <jakub@…> (2018-11-11 15:47:39)
Message:

Preallocate the waitq handle

This fixes a race condition (a missing wakeup) when the wakeup was
faster than the thread going to sleep and no handle was allocated yet.
The handle get preallocated to avoid a possible allocation failure in
wakeup.

We also switched to using atomic_compare_exchange_weak_explicit() to fix
ARMv4 and ARMv5 builds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/thread/futex.c

    r0b5203b r8a18d5b  
    5353{
    5454        atomic_store_explicit(&futex->val, val, memory_order_relaxed);
    55         atomic_store_explicit(&futex->alloc_lock, 0, memory_order_relaxed);
     55        atomic_store_explicit(&futex->lock, 0, memory_order_relaxed);
    5656        futex->whandle = CAP_NIL;
    5757}
Note: See TracChangeset for help on using the changeset viewer.