[Qt-interest] Multiple up/down with QSemaphore

DiogoLR diogolr at gmail.com
Tue Apr 5 18:23:06 CEST 2011


Hi there,

Some time ago, I did a software that made use of multiple (or simultaneous)
UP or DOWN operations on semaphores. At that time, Qt don't had a QSemaphore
class yet, so I had to do it with the OS API.

The application was dedicated to Linux, and i had no problem to do that with
the *semop* function. I just had to pass a *sembuf* structure array to the
function and, specify the operations (UP or DOWN) for each semaphore. The OS
API assured me that the operation had to be done simultaneously, so I don't
had any disturbance. If all operations couldn't be done simultaneously, the
thread was blocked.

Now, facing the same problem, on a multiplataform approach (windows, linux
...), I'm thinking to use a QSemaphore class, but I don't see how can I do
it, because this class have no "multiple_acquire_release" method.

*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? :)

Regards,

Diogo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110405/f79b5dd7/attachment.html 


More information about the Qt-interest-old mailing list