remove mutex code
This commit is contained in:
@ -33,47 +33,6 @@ static void error_exit(int err, const char *msg)
|
||||
abort();
|
||||
}
|
||||
|
||||
void qemu_mutex_init(QemuMutex *mutex)
|
||||
{
|
||||
int err;
|
||||
pthread_mutexattr_t mutexattr;
|
||||
|
||||
pthread_mutexattr_init(&mutexattr);
|
||||
pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
err = pthread_mutex_init(&mutex->lock, &mutexattr);
|
||||
pthread_mutexattr_destroy(&mutexattr);
|
||||
if (err)
|
||||
error_exit(err, __func__);
|
||||
}
|
||||
|
||||
void qemu_mutex_destroy(QemuMutex *mutex)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_destroy(&mutex->lock);
|
||||
if (err)
|
||||
error_exit(err, __func__);
|
||||
}
|
||||
|
||||
|
||||
void qemu_mutex_lock(QemuMutex *mutex)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_lock(&mutex->lock);
|
||||
if (err)
|
||||
error_exit(err, __func__);
|
||||
}
|
||||
|
||||
void qemu_mutex_unlock(QemuMutex *mutex)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = pthread_mutex_unlock(&mutex->lock);
|
||||
if (err)
|
||||
error_exit(err, __func__);
|
||||
}
|
||||
|
||||
int qemu_thread_create(struct uc_struct *uc, QemuThread *thread, const char *name,
|
||||
void *(*start_routine)(void*),
|
||||
void *arg, int mode)
|
||||
|
@ -30,36 +30,6 @@ static void error_exit(int err, const char *msg)
|
||||
//abort();
|
||||
}
|
||||
|
||||
void qemu_mutex_init(QemuMutex *mutex)
|
||||
{
|
||||
mutex->owner = 0;
|
||||
InitializeCriticalSection(&mutex->lock);
|
||||
}
|
||||
|
||||
void qemu_mutex_destroy(QemuMutex *mutex)
|
||||
{
|
||||
assert(mutex->owner == 0);
|
||||
DeleteCriticalSection(&mutex->lock);
|
||||
}
|
||||
|
||||
void qemu_mutex_lock(QemuMutex *mutex)
|
||||
{
|
||||
EnterCriticalSection(&mutex->lock);
|
||||
|
||||
/* Win32 CRITICAL_SECTIONs are recursive. Assert that we're not
|
||||
* using them as such.
|
||||
*/
|
||||
assert(mutex->owner == 0);
|
||||
mutex->owner = GetCurrentThreadId();
|
||||
}
|
||||
|
||||
void qemu_mutex_unlock(QemuMutex *mutex)
|
||||
{
|
||||
assert(mutex->owner == GetCurrentThreadId());
|
||||
mutex->owner = 0;
|
||||
LeaveCriticalSection(&mutex->lock);
|
||||
}
|
||||
|
||||
struct QemuThreadData {
|
||||
/* Passed to win32_start_routine. */
|
||||
void *(*start_routine)(void *);
|
||||
|
Reference in New Issue
Block a user