lock: merge spinlock and mtx locks into one
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
3e5abada9b
commit
2076f1dae1
32 changed files with 158 additions and 169 deletions
|
|
@ -3,7 +3,7 @@
|
|||
#define _rbtree_tH_
|
||||
|
||||
#include <kernel/common.h>
|
||||
#include <kernel/spinlock.h>
|
||||
#include <kernel/lock.h>
|
||||
|
||||
#define RB_RED 0
|
||||
#define RB_BLACK 1
|
||||
|
|
@ -26,7 +26,7 @@ typedef struct _rbnode_t {
|
|||
*/
|
||||
typedef struct _rbtree_t {
|
||||
rbnode_t *root;
|
||||
spinlock_t lock;
|
||||
lock_t lock;
|
||||
size_t num_nodes;
|
||||
} rbtree_t;
|
||||
|
||||
|
|
@ -40,12 +40,12 @@ rbnode_t *rbt_minimum(rbnode_t *node);
|
|||
|
||||
static inline void rbt_lock(rbtree_t *tree)
|
||||
{
|
||||
spinlock_acquire(&tree->lock);
|
||||
spin_lock(&tree->lock);
|
||||
}
|
||||
|
||||
static inline void rbt_unlock(rbtree_t *tree)
|
||||
{
|
||||
spinlock_release(&tree->lock);
|
||||
spin_unlock(&tree->lock);
|
||||
}
|
||||
|
||||
void rbt_init();
|
||||
|
|
|
|||
Loading…
Reference in a new issue