[Qt-interest] Multiple up/down with QSemaphore

DiogoLR diogolr at gmail.com
Tue Apr 5 21:50:36 CEST 2011


Exactly like Atlant Schmidt said... I'm trying to acquire multiple
independent resources each guarded by unique semaphores.

Thanks for the explanation, Atlant :).

Regards,

Diogo.


2011/4/5 Atlant Schmidt <aschmidt at dekaresearch.com>

> Sean:
>
>  I'm having trouble mapping your reply to DiogoLR's question.
>  He's not trying to acquire multiple resources guarded by a
>  single semaphore; instead, he seems to be trying to acquire
>  multiple independent resources each guarded by unique
>  semaphores (in Linux/Unix terms, a "semaphore set").
>
>  He could build this functionality, of course, by guarding
>  a bunch of semaphore-like objects (perhaps even QSemaphores)
>  with a Mutex.
>
>                              Atlant
>
>
> -----Original Message-----
> From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:
> qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of
> Sean Harmer
> Sent: Tuesday, April 05, 2011 12:53
> To: qt-interest at qt.nokia.com
> Subject: Re: [Qt-interest] Multiple up/down with QSemaphore
>
> 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
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
> This e-mail and the information, including any attachments, it contains are
> intended to be a confidential communication only to the person or entity to
> whom it is addressed and may contain information that is privileged. If the
> reader of this message is not the intended recipient, you are hereby
> notified that any dissemination, distribution or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please immediately notify the sender and destroy the
> original message.
>
> Thank you.
>
> Please consider the environment before printing this email.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110405/82783e34/attachment.html 


More information about the Qt-interest-old mailing list