Changeset c842f04 in mainline for src/synch/spinlock.c


Ignore:
Timestamp:
2005-09-01T09:19:56Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e3b9572
Parents:
f9447155
Message:

Preemption work.
Instrument spinlock functions with preemption_disable() and preemption_enable() calls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/synch/spinlock.c

    rf9447155 rc842f04  
    3232#include <arch/barrier.h>
    3333#include <synch/spinlock.h>
     34#include <preemption.h>
    3435#include <print.h>
    3536
     
    4748        __address caller = ((__u32 *) &sl)[-1];
    4849
     50        preemption_disable();
    4951        while (test_and_set(&sl->val)) {
    5052                if (i++ > 300000) {
     
    5961void spinlock_lock(spinlock_t *sl)
    6062{
     63        preemption_disable();
     64
    6165        /*
    6266         * Each architecture has its own efficient/recommended
     
    7276        int rc;
    7377       
     78        preemption_disable();
    7479        rc = !test_and_set(&sl->val);
    7580        CS_ENTER_BARRIER();
     81
     82        if (!rc)
     83                preemption_enable();
    7684       
    7785        return rc;
     
    8290        CS_LEAVE_BARRIER();
    8391        sl->val = 0;
     92        preemption_enable();
    8493}
    8594
Note: See TracChangeset for help on using the changeset viewer.