[fpc-devel] simpleipc issues

Ondrej Pokorny lazarus at kluug.net
Tue Sep 15 09:52:02 CEST 2015

On 15.09.2015 08:58, Michael Van Canneyt wrote:
> On Mon, 14 Sep 2015, Ondrej Pokorny wrote:
>> I've developed a "single/multiple instances" feature for the Lazarus 
>> IDE. For this feature I need an IPC. First I tried to use simpleipc 
>> but I have struggled on bugs and missing functionality.
>> Particularly what I found:
>> 1.) BUG: You can register multiple servers on Windows with the same 
>> name (with StartServer procedure).
>> 2.) Small issue: simpleipc uses exceptions if something fails (e.g. 
>> in StartServer procedure). I would prefer using a function with 
>> boolean result (true = OK, false = fail).
>> 3.) MISSING: Multiple clients (from different processes) talk to one 
>> server.
>> 4.) MISSING: Client is able to receive a response on a request.
>> 5.) MISSING: (Optionally, not default) client sends a request to a 
>> server that isn't running. The server is able to handle these 
>> requests when it is started.
>> So I developed "advancedipc.pas" that does what I need. It can do 
>> everything that is in simpleirc but a little bit differently (I 
>> changed the exception behavior and also method names). The question 
>> is now what to do?
>> 1.) Include advancedipc.pas into FCL as a standalone unit.
>> 2.) Make advancedipc.pas backwards compatible to simpleipc.pas and 
>> use the new code in simpleipc.pas.
> Well, both 1 and 2 are the way to go if you want it included in FPC :-)
> I see no point in including duplicate functionality, it means 
> duplicate maintenance. You can keep it as separate units, just make 
> sure simpleipc runs on top of advancedipc.
> As for no semaphores on linux: of course there are semaphores, they 
> exist since many many years, they are part of POSIX: "man sem_overview".
> Michael.

Thanks a lot Michael!

I'll prepare it, write (unit) tests and some demo and then send them 
over! Thanks also for the semaphore information. I couldn't find 
anything on the internet, therefore I thought Lazarus doesn't support them.

Are there some high level crossplatform semaphore functions in the FCL? 
The cthreads/cIntSemaphoreOpen etc. seem to be available on unix only. 
What about OS/2?

What about Windows? It looks like semaphores are supported only since 
. Is this a problem for the FCL? (Basically, semaphores are only needed 
on unix due to the file locking. But I am still interested.)

If I'll have more questions, I'll write them here.


More information about the fpc-devel mailing list