summaryrefslogtreecommitdiff
path: root/qmake/tools/qwaitcondition_unix.cpp
Side-by-side diff
Diffstat (limited to 'qmake/tools/qwaitcondition_unix.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qmake/tools/qwaitcondition_unix.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/qmake/tools/qwaitcondition_unix.cpp b/qmake/tools/qwaitcondition_unix.cpp
index 99c1014..6684617 100644
--- a/qmake/tools/qwaitcondition_unix.cpp
+++ b/qmake/tools/qwaitcondition_unix.cpp
@@ -125,5 +125,5 @@ struct QWaitConditionPrivate {
mymutex.lock();
// Sleep until there are no busy worker threads
- while( count > 0 ) {
+ while( mycount > 0 ) {
mymutex.unlock();
sleep( 1 );
@@ -225,5 +225,7 @@ void QWaitCondition::wakeAll()
bool QWaitCondition::wait(unsigned long time)
{
- pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_t mutex;
+ pthread_mutex_init( &mutex, 0 );
+ pthread_mutex_lock( &mutex );
int ret;
@@ -233,5 +235,5 @@ bool QWaitCondition::wait(unsigned long time)
timespec ti;
- ti.tv_nsec = (tv.tv_usec * 1000) + (time % 1000) * 1000;
+ ti.tv_nsec = ( tv.tv_usec + ( time % 1000 ) * 1000 ) * 1000;
ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 );
ti.tv_nsec %= 1000000000;
@@ -246,4 +248,7 @@ bool QWaitCondition::wait(unsigned long time)
#endif
+ pthread_mutex_unlock( &mutex );
+ pthread_mutex_destroy( &mutex );
+
return (ret == 0);
}
@@ -292,5 +297,5 @@ bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
timespec ti;
- ti.tv_nsec = (tv.tv_usec * 1000) + (time % 1000) * 1000;
+ ti.tv_nsec = ( tv.tv_usec + ( time % 1000 ) * 1000 ) * 1000;
ti.tv_sec = tv.tv_sec + (time / 1000) + ( ti.tv_nsec / 1000000000 );
ti.tv_nsec %= 1000000000;