mirror of https://github.com/xemu-project/xemu.git
qemu-thread: delete unused functions
qemu_mutex_timedlock() and qemu_cond_timedwait() are no longer used. Remove them and their helper timespec_add_ms(). Reported-by: François Revol <revol@free.fr> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
1a290aea8d
commit
44bc10d5bc
|
@ -61,30 +61,6 @@ int qemu_mutex_trylock(QemuMutex *mutex)
|
|||
return pthread_mutex_trylock(&mutex->lock);
|
||||
}
|
||||
|
||||
static void timespec_add_ms(struct timespec *ts, uint64_t msecs)
|
||||
{
|
||||
ts->tv_sec = ts->tv_sec + (long)(msecs / 1000);
|
||||
ts->tv_nsec = (ts->tv_nsec + ((long)msecs % 1000) * 1000000);
|
||||
if (ts->tv_nsec >= 1000000000) {
|
||||
ts->tv_nsec -= 1000000000;
|
||||
ts->tv_sec++;
|
||||
}
|
||||
}
|
||||
|
||||
int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs)
|
||||
{
|
||||
int err;
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
timespec_add_ms(&ts, msecs);
|
||||
|
||||
err = pthread_mutex_timedlock(&mutex->lock, &ts);
|
||||
if (err && err != ETIMEDOUT)
|
||||
error_exit(err, __func__);
|
||||
return err;
|
||||
}
|
||||
|
||||
void qemu_mutex_unlock(QemuMutex *mutex)
|
||||
{
|
||||
int err;
|
||||
|
@ -139,20 +115,6 @@ void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex)
|
|||
error_exit(err, __func__);
|
||||
}
|
||||
|
||||
int qemu_cond_timedwait(QemuCond *cond, QemuMutex *mutex, uint64_t msecs)
|
||||
{
|
||||
struct timespec ts;
|
||||
int err;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
timespec_add_ms(&ts, msecs);
|
||||
|
||||
err = pthread_cond_timedwait(&cond->cond, &mutex->lock, &ts);
|
||||
if (err && err != ETIMEDOUT)
|
||||
error_exit(err, __func__);
|
||||
return err;
|
||||
}
|
||||
|
||||
void qemu_thread_create(QemuThread *thread,
|
||||
void *(*start_routine)(void*),
|
||||
void *arg)
|
||||
|
|
|
@ -15,7 +15,6 @@ void qemu_mutex_init(QemuMutex *mutex);
|
|||
void qemu_mutex_destroy(QemuMutex *mutex);
|
||||
void qemu_mutex_lock(QemuMutex *mutex);
|
||||
int qemu_mutex_trylock(QemuMutex *mutex);
|
||||
int qemu_mutex_timedlock(QemuMutex *mutex, uint64_t msecs);
|
||||
void qemu_mutex_unlock(QemuMutex *mutex);
|
||||
|
||||
void qemu_cond_init(QemuCond *cond);
|
||||
|
@ -29,7 +28,6 @@ void qemu_cond_destroy(QemuCond *cond);
|
|||
void qemu_cond_signal(QemuCond *cond);
|
||||
void qemu_cond_broadcast(QemuCond *cond);
|
||||
void qemu_cond_wait(QemuCond *cond, QemuMutex *mutex);
|
||||
int qemu_cond_timedwait(QemuCond *cond, QemuMutex *mutex, uint64_t msecs);
|
||||
|
||||
void qemu_thread_create(QemuThread *thread,
|
||||
void *(*start_routine)(void*),
|
||||
|
|
Loading…
Reference in New Issue