[fpc-pascal] Inter-process communication, a cautionary tale
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Wed Jul 18 18:15:06 CEST 2012
OBones wrote:
> Mark Morgan Lloyd wrote:
>> Basically, what I was trying to do was this. In the main thread:
>>
>> fIpcPipe:= CreateNamedPipe(PChar(fIpcName), PIPE_ACCESS_INBOUND,
>> PIPE_TYPE_MESSAGE + PIPE_READMODE_MESSAGE,
>> 1, 0, 0, 1000, NIL (* @sa *) );
>>
>> That works. Fire up a background reader thread, and make sure that the
>> main thread doesn't proceed...
> So you are not creating the "read" pipe in the context of the thread
> that actually reads from it?
> I'm not sure that this is actually supported, maybe you should try to
> create it in the context of the reading thread.
I agree, but ever since threads were introduced (OS/2 v1 or perhaps even
earlier) doctrine has had it that ownership (of memory, handles and so
on) was by process while state (stack content and runability) was by thread.
Other points noted, in particular that my problem might be that I can't
distribute certain types of activity over threads rather than (as I
initially assumed) that things had to be distributed over multiple
processes.
In any event, I can get away without having this working. If I do manage
to hack it at some point I'll try to remember to report back.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list