while working on my actor model concurrency for freepascal i met the following problem.
Each actor has a mailbox, that is made of the following components : A standard TObjectQueue wich holds the messages A TMultiReadExclusiveWriteSynchronizer that avoids race conditions while acessing the TObjectQueue. A TEventObject that is used to signalize when a new object is pushed into the queue. Usefull if the actor wants a message but the queue is empty. (Writer triggers the signal and the reader sleeps until the signal is received). Well, the problem i hit is the following : Each message has a transactionID value that is used to differentiate among transactions. This is usefull when you need a synchronous transfer to happen on the fully assynchronous actor model. An actor sends a request message and waits for a response message, both with the same transaction id. While developing this framework i set myself the task of making it with two guarantees that are not much common on other actor model implementations : Guaranteed message order and Guaranteed message delivery. well well, thats where i need a TObjectQueue with ability to dequeue/inspect arbitrary positions : When the object issues request it has to keep looping (until timeout) and dequeueing the last message from the mailbox, inspecting its transaction id for a match and requeueing the same message back into the mailbox if theres no match. Thats the problem. When messages are requeued i lose message order guarantees (Very usefull). They are still guaranteed to be delivered, but not in order anymore. Finishing the long story, i need a TObjectQueue that can access/extract arbitrary positions so as to avoiding losing the order of message delivery. Does anybody have one already done/debugged and in GPL license ? Thanks in advance, J. Aldo. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal