All pastes #744497 Raw Edit

Stuff

public text v1 · immutable
#744497 ·published 2007-10-21 15:22 UTC
rendered paste body
bool queue_peek(struct event_queue *q, struct queue_event *ev)
{
    bool have_msg = false;
    int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL);
    corelock_lock(&q->cl);
    
    if (q->read != q->write)
    {
        *ev = q->events[q->read & QUEUE_LENGTH_MASK];
        have_msg = true;
    }
    
    corelock_unlock(&q->cl);
    set_irq_level(oldlevel);

    return have_msg;    
}