[fpc-devel] simpleipc issues

Ondrej Pokorny lazarus at kluug.net
Mon Sep 21 14:03:19 CEST 2015

On 15.09.2015 15:16, Michael Schnell wrote:
> On 09/15/2015 02:43 PM, Michael Van Canneyt wrote:
>> With my paranoid mind I of course assumed you were hijacking the 
>> thread...
> Of course I was eagerly waiting on Ondrej to confirm that he was 
> looking for thread support :-) :-) :-)
> -Michael

A quick check of the code I posted before you tried to politely set a 
trigger would have spared you the trouble :-) :-) :-)

Michael Van Canneyt & Tomas Hajny & everybody who wants to test:

I prepared a fully compatible AdvancedIPC unit. See the attachment.
There is a unit mysimpleipc.pp that should replace the simpleipc.pp in 
FPC sources. I renamed it in order to prevent file name problems and to 
be able to check the compatibility without recompiling FPC sources 
(basically just use "mysimpleipc" in the uses instead of "simpleipc").

Description of projects:
dbugsrv.lpi, ipcclient.lpi, ipcserver.lpi: demos from FPC sources just 
to check backwards compatibility.
TestIPC_Client.lpi + TestIPC_Server.lpi: server/client test of new 
AdvancedIPC features.

I haven't implemented any global semaphores etc to work around the file 
locking problem on unix. They were not present in simpleipc, they are 
not present in the TFileStream implementation and as I read the 
discussion about the problem, I'd rather do it without them and keep the 
limitation. Maybe I should write about this limitation in the header.

I also modified the internal message header. That means that both client 
and server must be compiled with the new units. But this is a must 
anyway because the whole back-end code changed (e.g. on Windows from 
messages to temporary files). I have a "FileLock" field in the header as 
well that serves as an extra file lock flag. This is not needed under 
Windows because file locks work there but my tests on Linux showed that 
file locks work only across different processes. The same process seems 
to be able to access a locked file from 2 FileCreate calls (please 
correct me if I am wrong). So this is just a bullet-proof check. If you 
think it is not needed, I remove it.

If you have questions about the code, feel free to ask or if you found 
some issues/bugs, please tell me about them as well.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: AdvancedIPC.zip
Type: application/x-zip-compressed
Size: 14240 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20150921/24bcaf25/attachment.bin>

More information about the fpc-devel mailing list