[Interest] tryLock for QSystemSemaphore

Thiago Macieira thiago.macieira at intel.com
Sat Oct 21 18:51:22 CEST 2017


On Saturday, 21 October 2017 09:42:45 PDT Konstantin Shegunov wrote:
> On Sat, Oct 21, 2017 at 7:35 PM, Thiago Macieira <thiago.macieira at intel.com>
> wrote:
> > The reason is that it was never implemented. I've just checked and both
> > backends could have it.
> 
> This is encouraging. Could we maybe have that implemented/added to the
> class for a future release?

Yes, if someone writes the code. I'm not volunteering.

> > As to what you're stuck with, we need to know what you're trying to do.
> 
> Well, I'm about to start writing autotests for a small module I've written.
> It's an IPC message passing wrapper (around OpenMPI) so I'd need a
> "concurrent" IPC sync technique to be able to test how it fares, e. g. if
> synchronous communication in the module is working as expected. That's why
> I thought I might take advantage of Qt's system sem. class. Unfortunately,
> `acquire()` doesn't ever free the thread it's called from, so a possible
> workaround I see currently is to start a thread and handle the timeout
> manually - releasing the system semaphore by hand if time runs out.

What do you mean by that? .acquire() does return (if that's what you mean by 
"free the thread") if there was something to be acquired. So the question back 
to you is why there wasn't something to be acquired?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list