author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/tools/qsemaphore_unix.cpp | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
Diffstat (limited to 'qmake/tools/qsemaphore_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/tools/qsemaphore_unix.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/qmake/tools/qsemaphore_unix.cpp b/qmake/tools/qsemaphore_unix.cpp index fcf28da..4516049 100644 --- a/qmake/tools/qsemaphore_unix.cpp +++ b/qmake/tools/qsemaphore_unix.cpp | |||
@@ -183,18 +183,17 @@ int QSemaphore::operator+=(int n) | |||
183 | 183 | ||
184 | d->mutex.lock(); | 184 | d->mutex.lock(); |
185 | 185 | ||
186 | if ( n < 0 || n > d->max ) { | ||
187 | #ifdef QT_CHECK_RANGE | ||
188 | qWarning( "QSemaphore::operator+=: paramter %d out of range", n ); | ||
189 | #endif // QT_CHECK_RANGE | ||
190 | n = n < 0 ? 0 : d->max; | ||
191 | } | ||
192 | |||
186 | while (d->value + n > d->max) | 193 | while (d->value + n > d->max) |
187 | d->cond.wait(&(d->mutex)); | 194 | d->cond.wait(&(d->mutex)); |
188 | 195 | ||
189 | d->value += n; | 196 | d->value += n; |
190 | |||
191 | #ifdef QT_CHECK_RANGE | ||
192 | if (d->value > d->max) { | ||
193 | qWarning("QSemaphore::operator+=: attempt to allocate more resources than available"); | ||
194 | d->value = d->max; | ||
195 | } | ||
196 | #endif | ||
197 | |||
198 | ret = d->value; | 197 | ret = d->value; |
199 | 198 | ||
200 | d->mutex.unlock(); | 199 | d->mutex.unlock(); |
@@ -212,15 +211,14 @@ int QSemaphore::operator-=(int n) | |||
212 | 211 | ||
213 | d->mutex.lock(); | 212 | d->mutex.lock(); |
214 | 213 | ||
215 | d->value -= n; | 214 | if ( n < 0 || n > d->value ) { |
216 | |||
217 | #ifdef QT_CHECK_RANGE | 215 | #ifdef QT_CHECK_RANGE |
218 | if (d->value < 0) { | 216 | qWarning( "QSemaphore::operator-=: paramter %d out of range", n ); |
219 | qWarning("QSemaphore::operator-=: attempt to deallocate more resources than taken"); | 217 | #endif // QT_CHECK_RANGE |
220 | d->value = 0; | 218 | n = n < 0 ? 0 : d->value; |
221 | } | 219 | } |
222 | #endif | ||
223 | 220 | ||
221 | d->value -= n; | ||
224 | ret = d->value; | 222 | ret = d->value; |
225 | 223 | ||
226 | d->cond.wakeOne(); | 224 | d->cond.wakeOne(); |