- Define a _spinunlock() function so that threading implementations may do
more complicated things than just setting the lock to 0. - Implement stubs for this function in libc and the two threading libraries that are currently in the tree.
This commit is contained in:
parent
6410552316
commit
cc3521d660
|
@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
|
|||
*/
|
||||
__weak_reference(_atomic_lock_stub, _atomic_lock);
|
||||
__weak_reference(_spinlock_stub, _spinlock);
|
||||
__weak_reference(_spinlock_stub, _spinunlock);
|
||||
__weak_reference(_spinlock_debug_stub, _spinlock_debug);
|
||||
|
||||
|
||||
|
@ -64,6 +65,14 @@ _spinlock_stub(spinlock_t *lck)
|
|||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is a stub for the spinunlock function in libpthread.
|
||||
*/
|
||||
void
|
||||
_spinunlock_stub(spinlock_t *lck)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is a stub for the debug spinlock function in libpthread.
|
||||
*/
|
||||
|
|
|
@ -52,7 +52,7 @@ typedef struct {
|
|||
|
||||
#define _SPINLOCK_INITIALIZER { 0, 0, 0, 0 }
|
||||
|
||||
#define _SPINUNLOCK(_lck) (_lck)->access_lock = 0
|
||||
#define _SPINUNLOCK(_lck) _spinunlock(_lck);
|
||||
#ifdef _LOCK_DEBUG
|
||||
#define _SPINLOCK(_lck) _spinlock_debug(_lck, __FILE__, __LINE__)
|
||||
#else
|
||||
|
@ -65,6 +65,7 @@ typedef struct {
|
|||
__BEGIN_DECLS
|
||||
long _atomic_lock(volatile long *);
|
||||
void _spinlock(spinlock_t *);
|
||||
void _spinunlock(spinlock_t *);
|
||||
void _spinlock_debug(spinlock_t *, char *, int);
|
||||
__END_DECLS
|
||||
|
||||
|
|
|
@ -44,6 +44,12 @@
|
|||
|
||||
#include "pthread_private.h"
|
||||
|
||||
void
|
||||
_spinunlock(spinlock_t *lck)
|
||||
{
|
||||
lck->access_lock = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock a location for the running thread. Yield to allow other
|
||||
* threads to run if this thread is blocked because the lock is
|
||||
|
|
|
@ -44,6 +44,13 @@
|
|||
|
||||
#include "thr_private.h"
|
||||
|
||||
void
|
||||
_spinunlock(spinlock_t *lck)
|
||||
{
|
||||
lck->access_lock = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Lock a location for the running thread. Yield to allow other
|
||||
* threads to run if this thread is blocked because the lock is
|
||||
|
|
|
@ -44,6 +44,13 @@
|
|||
|
||||
#include "thr_private.h"
|
||||
|
||||
void
|
||||
_spinunlock(spinlock_t *lck)
|
||||
{
|
||||
lck->access_lock = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Lock a location for the running thread. Yield to allow other
|
||||
* threads to run if this thread is blocked because the lock is
|
||||
|
|
Loading…
Reference in New Issue