You are not logged in.
Pages: 1
Hi,
I'm asking this and maybe this is a stupid question:
We need to implement sicSingle service (multithreaded) and each call (same method) should wait for previous to end:
We get 1., 2., 3., ... n. call ... 1. is processing and others should wait and when the 1. ends, 2. comes in.
Is this already implemented in Mormot ?
We want to stay in method until it finishes or timeouts.
Or does someone has better idea ?
Thank you,
Vojko Cendak
Offline
We are using sicShared and when we need serialized access to somene services we use TSynLocker.Lock and TSynLocker.Unlock in a try .. finally.
Esteban
Offline
I believe that this topic in the documentation will help you:
Offline
Thank you,
sicShared works this way but then another mothods are also blocked.
sicSingle:
We solved it with application logic, eg. per mothod calls managment, timoeut, max number of wait in que.
Is there posibility to get count of currently executing methods by name or ... ?
Thank you all,
Vojko Cendak
Offline
sicShared works this way but then another mothods are also blocked.
Using lock/unlock inside the endpoint of interface service does not block other endpoints of the interface service.
Esteban
Offline
sicShared does NOT lock anything.
Check https://synopse.info/files/html/Synopse … ml#TITL_92
There is just a single instance of the class implementing the interface, shared by all callers.
It is up to the code writer to make its methods thread-safe, e.g. using TSynLock in appropriate points of the server-side code.
If you have some very long process, use interface callbacks for server-side notifications to the client side.
Please see the https://synopse.info/files/html/Synopse … l#TITL_152 documentation that @macfly quoted about.
Offline
Thank you for replies.
Indeed sicShared only has one instance and does not lock anything.
-- If you have some very long process
It's not so much about long process, here's situation where's a device that must have serialized access (which happen a lot in real life)
and mwthods need to be serialized (wait in que from multiple sources). So we need some kind of control: number of calls in que, timeouts, priorities...
Maybe isn't crazy idea to implement some kind of serialization of per method calls.
It's already impelented with SyncWithMainThread actually (what we use in production succesfully for several years )
that was done gratiously by ab.
Regards, Vojko
Offline
Pages: 1