[fpc-pascal] Network mutex

Jorge Aldo G. de F. Junior jagfj80 at gmail.com
Tue Aug 21 17:24:33 CEST 2012

You could implement such a thing using my Pascal-Actor-Model classes.

Simple TCP streams (or UDP with added guarantees) and a central actor
that decides who use what.


theres an udp sender/receiver actor that share a socket to send and
receive messages.

You will need to implement guarantees of packet delivery using counters etc.

the mailbox model used on actors guarantee that only one computer will
use the resource, because the mailbox is a FIFO.

All actors run assynchronously.

Theres a call called request() that can synchronize two actors. Thats
where you can implement a network mutex/semaphore. (Request sleeps up
to timeout until the reply comes, all messages are sent into a fifo,
so if two instances request the same thing, one of them will sleep
until the first to come is serviced).

i need to implement the class serializer/deserializer because in the
long run i plan to implement distributed computing. A serializer is
already done, but is not in actor format yet. After that i will need
to implement some distributed helpers. There is already a round robin
load balancer.

But i believe the foundation for what you want is already implemented.

Bear in mind that the problem you proposed is trivial with lnet or
synapse. Its just a network service that can be done in a couple of
hours using those libraries.

2012/8/21 Fabio Luis Girardi <fluisgirardi at gmail.com>:
> Hi!!
> I'm searching about Network mutex/semaphore. The main idea is avoid
> multiple computers (running applications built with FPC) access at the
> same time a single network resource (like a PLC). The only solution at
> the moment is use a DB with transactions, but this is a non elegant
> solution.
> So, anyone knows if FPC or other library provides this functionality?
> --
> The best regards,
> Fabio Luis Girardi
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list