summaryrefslogtreecommitdiffstats
path: root/src/kernel/spinlock.C
blob: bfada05c4106765c1fe9a6296a1a76d34e2e59de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <kernel/spinlock.H>

void Spinlock::lock()
{
    uint64_t reservation = __sync_fetch_and_add(&iv_reserve, 1);
    while(iv_ready != reservation);
}

void Spinlock::unlock()
{
    __sync_add_and_fetch(&iv_ready, 1);
}
OpenPOWER on IntegriCloud