Changeset 7dd56f1 in mainline for src/synch/spinlock.c


Ignore:
Timestamp:
2005-08-07T23:14:14Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
511b45f
Parents:
60f760a0
Message:

Add memory barriers into spinlock_*().
Implement CS_{ENTER|LEAVE}_BARRIER() for IA-32 (no-op).
Provide incomplete CS_{ENTER|LEAVE}_BARRIER() macros for IA-64 and MIPS as well.

Small changes here and there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/synch/spinlock.c

    r60f760a0 r7dd56f1  
    3030
    3131#include <arch/atomic.h>
     32#include <arch/barrier.h>
    3233#include <synch/spinlock.h>
    3334
     
    5152                }
    5253        }
     54        CS_ENTER_BARRIER();
    5355
    5456}
     
    6163         */
    6264        spinlock_arch(&sl->val);
     65        CS_ENTER_BARRIER();
    6366}
    6467#endif
     
    6669int spinlock_trylock(spinlock_t *sl)
    6770{
    68         return !test_and_set(&sl->val);
     71        int rc;
     72       
     73        rc = !test_and_set(&sl->val);
     74        CS_ENTER_BARRIER();
     75       
     76        return rc;
    6977}
    7078
    7179void spinlock_unlock(spinlock_t *sl)
    7280{
     81        CS_LEAVE_BARRIER();
    7382        sl->val = 0;
    7483}
Note: See TracChangeset for help on using the changeset viewer.