Synchronized Interprocess Communication


#1

JUCE offers Interprocess Communication, which is very nice, but I would like to have some kind of ScopedLock object for IPC.

Would it be difficult to create some kind of class that works like this:

ScopedLock(const String &name);

This would, if there is none, create some kind of synchronisation object referenced by “name”. Then it would just lock it like a CriticalSection, and if other processes would try to access that lock at the time it still exists in process1, they would have to wait.

I have never used IPC, but it is very important for my application to have some kind of lock like this.

Would this be hard to implement?


#2

did you see the InterProcessLock class?


#3

Thanks :oops: I was already implementing my own class now … You really thought of everything in JUCE, that’s very nice!


#4

Hi Jules,

In the same register, is there an implementation of “Condition Variables” in Juce?
I’m looking for something like http://www.boost.org/doc/libs/1_43_0/doc/html/interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.conditions

Else, is there another way to make a synchronous call through a pipe? I.e. sending data to another process and waiting for its answer before returning the current function?


#5

That just sounds like a WaitableEvent to me…


#6

Given that InterprocessConnection inherits from thread, can’t we just use the usual wait()/notify() mechanism ?


#7

In case it’s useful for someone else, WaitableEvent worked like a charm…