Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch
This commit is contained in:
commit
ffdd3b21d2
|
@ -18,6 +18,9 @@ typedef pthread_cond_t cond_t;
|
|||
#define THR_DETACHED 2
|
||||
#define THR_DAEMON 4
|
||||
|
||||
#define USYNC_THREAD 0x00 /* private to a process */
|
||||
#define USYNC_PROCESS 0x01 /* shared by processes */
|
||||
|
||||
#define thr_self() pthread_self()
|
||||
#define thr_sigsetmask pthread_sigmask
|
||||
#define __nthreads() 2 /* XXX: Force multi-thread */
|
||||
|
@ -41,6 +44,20 @@ thr_create(void *stack_base, size_t stack_size,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mutex_held(mutex_t *mp)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = pthread_mutex_trylock(mp);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
pthread_mutex_unlock(mp);
|
||||
return rc;
|
||||
}
|
||||
#define MUTEX_HELD(mp) mutex_held(mp)
|
||||
|
||||
#define mutex_init(mp, type, arg) pthread_mutex_init(mp, NULL)
|
||||
#define mutex_lock(mp) pthread_mutex_lock(mp)
|
||||
#define mutex_unlock(mp) pthread_mutex_unlock(mp)
|
||||
|
@ -48,7 +65,6 @@ thr_create(void *stack_base, size_t stack_size,
|
|||
#define mutex_trylock(mp) pthread_mutex_trylock(mp)
|
||||
#define DEFAULTMUTEX PTHREAD_MUTEX_INITIALIZER
|
||||
#define DEFAULTCV PTHREAD_COND_INITIALIZER
|
||||
#define MUTEX_HELD(mp) 1 /* XXX: Use mutex_trylock() */
|
||||
|
||||
#define cond_init(c, type, arg) pthread_cond_init(c, NULL)
|
||||
#define cond_wait(c, m) pthread_cond_wait(c, m)
|
||||
|
|
|
@ -58,7 +58,7 @@ typedef struct umem_cache {
|
|||
size_t cache_align;
|
||||
umem_constructor_t *cache_constructor;
|
||||
umem_destructor_t *cache_destructor;
|
||||
umem_reclaim_t *cache_reclaim
|
||||
umem_reclaim_t *cache_reclaim;
|
||||
void *cache_private;
|
||||
void *cache_arena;
|
||||
int cache_cflags;
|
||||
|
|
|
@ -203,32 +203,18 @@ extern kthread_t *zk_thread_create(void (*func)(void), void *arg);
|
|||
/*
|
||||
* Mutexes
|
||||
*/
|
||||
typedef struct kmutex {
|
||||
void *m_owner;
|
||||
boolean_t initialized;
|
||||
mutex_t m_lock;
|
||||
} kmutex_t;
|
||||
typedef mutex_t kmutex_t;
|
||||
|
||||
#define MUTEX_DEFAULT USYNC_THREAD
|
||||
#undef MUTEX_HELD
|
||||
#define MUTEX_HELD(m) _mutex_held(&(m)->m_lock)
|
||||
|
||||
/*
|
||||
* Argh -- we have to get cheesy here because the kernel and userland
|
||||
* have different signatures for the same routine.
|
||||
* Conflicts with lib/libspl/include/thread.h. The kernel and user
|
||||
* space prototypes differ forcing us to do some special handling.
|
||||
*/
|
||||
extern int _mutex_init(mutex_t *mp, int type, void *arg);
|
||||
extern int _mutex_destroy(mutex_t *mp);
|
||||
|
||||
#define mutex_init(mp, b, c, d) zmutex_init((kmutex_t *)(mp))
|
||||
#define mutex_destroy(mp) zmutex_destroy((kmutex_t *)(mp))
|
||||
|
||||
extern void zmutex_init(kmutex_t *mp);
|
||||
extern void zmutex_destroy(kmutex_t *mp);
|
||||
extern void mutex_enter(kmutex_t *mp);
|
||||
extern void mutex_exit(kmutex_t *mp);
|
||||
extern int mutex_tryenter(kmutex_t *mp);
|
||||
extern void *mutex_owner(kmutex_t *mp);
|
||||
#ifdef mutex_init
|
||||
#undef mutex_init
|
||||
#define mutex_init(mp, b, c, d) pthread_mutex_init(mp, NULL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RW locks
|
||||
|
|
Loading…
Reference in New Issue