[Qt-interest] Multiple up/down with QSemaphore

Sean Harmer sean.harmer at maps-technology.com
Tue Apr 5 18:53:19 CEST 2011


On Tuesday 05 April 2011 13:23:06 DiogoLR wrote:
> *P.S.: A VERY important note... I can't do the operations (down's and up's)
> sequentially, I have to do it simultaneously*.
> 
> Can someone help me with that? :)

Did you read the docs for QSemaphore::acquire(int n = 1)?

http://doc.qt.nokia.com/latest/qsemaphore.html#acquire

It says:

"Tries to acquire n resources guarded by the semaphore. If n > available(), 
this call will block until enough resources are available."

There is a corresponding release() function that accepts an int.

Cheers,

Sean




More information about the Qt-interest-old mailing list