C.wrap_pthread_mutex_lock
This commit is contained in:
@@ -5,3 +5,15 @@
|
|||||||
pthread_once_t llgoSyncOnceInitVal = PTHREAD_ONCE_INIT;
|
pthread_once_t llgoSyncOnceInitVal = PTHREAD_ONCE_INIT;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// wrap return type to void
|
||||||
|
void wrap_pthread_mutex_lock(pthread_mutex_t *mutex) {
|
||||||
|
pthread_mutex_lock(mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// wrap return type to void
|
||||||
|
void wrap_pthread_mutex_unlock(pthread_mutex_t *mutex) {
|
||||||
|
pthread_mutex_unlock(mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -79,15 +79,11 @@ func (m *Mutex) Destroy() {}
|
|||||||
// llgo:link (*Mutex).TryLock C.pthread_mutex_trylock
|
// llgo:link (*Mutex).TryLock C.pthread_mutex_trylock
|
||||||
func (m *Mutex) TryLock() c.Int { return 0 }
|
func (m *Mutex) TryLock() c.Int { return 0 }
|
||||||
|
|
||||||
func (m *Mutex) Lock() { lockInternal(m) }
|
// llgo:link (*Mutex).Lock C.wrap_pthread_mutex_lock
|
||||||
|
func (m *Mutex) Lock() {}
|
||||||
|
|
||||||
func (m *Mutex) Unlock() { unlockInternal(m) }
|
// llgo:link (*Mutex).Unlock C.wrap_pthread_mutex_unlock
|
||||||
|
func (m *Mutex) Unlock() {}
|
||||||
//go:linkname lockInternal C.pthread_mutex_lock
|
|
||||||
func lockInternal(m *Mutex) c.Int
|
|
||||||
|
|
||||||
//go:linkname unlockInternal C.pthread_mutex_unlock
|
|
||||||
func unlockInternal(m *Mutex) c.Int
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user