Merge pull request #576 from xushiwei/q
c/pthread/sync: use go:linkname for internal func
This commit is contained in:
@@ -5,3 +5,15 @@
|
||||
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);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -76,18 +76,14 @@ func (m *Mutex) Init(attr *MutexAttr) c.Int { return 0 }
|
||||
// llgo:link (*Mutex).Destroy C.pthread_mutex_destroy
|
||||
func (m *Mutex) Destroy() {}
|
||||
|
||||
func (m *Mutex) Lock() { m.lockInternal() }
|
||||
|
||||
// llgo:link (*Mutex).lockInternal C.pthread_mutex_lock
|
||||
func (m *Mutex) lockInternal() c.Int { return 0 }
|
||||
|
||||
// llgo:link (*Mutex).TryLock C.pthread_mutex_trylock
|
||||
func (m *Mutex) TryLock() c.Int { return 0 }
|
||||
|
||||
func (m *Mutex) Unlock() { m.unlockInternal() }
|
||||
// llgo:link (*Mutex).Lock C.wrap_pthread_mutex_lock
|
||||
func (m *Mutex) Lock() {}
|
||||
|
||||
// llgo:link (*Mutex).unlockInternal C.pthread_mutex_unlock
|
||||
func (m *Mutex) unlockInternal() c.Int { return 0 }
|
||||
// llgo:link (*Mutex).Unlock C.wrap_pthread_mutex_unlock
|
||||
func (m *Mutex) Unlock() {}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user