SX(9): Implement with reader/writer lock

This commit is contained in:
Sebastian Huber
2017-11-15 11:49:09 +01:00
parent 97a98f6cd7
commit cc7a8d87e7
3 changed files with 95 additions and 33 deletions

View File

@@ -31,7 +31,7 @@
#ifndef _SYS__SX_H_
#define _SYS__SX_H_
#ifdef __rtems__
#include <machine/rtems-bsd-mutex.h>
#include <machine/rtems-bsd-rwlock.h>
#endif /* __rtems__ */
/*
@@ -42,7 +42,7 @@ struct sx {
#ifndef __rtems__
volatile uintptr_t sx_lock;
#else /* __rtems__ */
rtems_bsd_mutex mutex;
rtems_bsd_rwlock rwlock;
#endif /* __rtems__ */
};

View File

@@ -44,9 +44,6 @@
#ifdef __rtems__
#define SX_NOINLINE 1
#define _sx_slock _bsd__sx_xlock
#define sx_try_slock_ _bsd_sx_try_xlock_
#define _sx_sunlock _bsd__sx_xunlock
#endif /* __rtems__ */
/*
* In general, the sx locks and rwlocks use very similar algorithms.