[erlang-questions] queue process with capacity

semmit mondo <>
Thu Mar 2 15:44:14 CET 2017


Hi, I need to implement a queue service that has a capacity.  This means that the `in` actions has to be able to block the producer when the queue is full, and also the `out` action has to be able to block the consumer when the queue is empty. Sending in an item and then receiving with "after infinity" in the producer seems to be a working approach.  But my concern is that this way the producer process is blocked and so it is unable to respond to any system messages.  If I do this in a supervised process, do I break the contract between OTP and that process?  Aren't all the processes supposed to answer certain low level messages that is handled by gen_server without me to even know about?  Shouldn't supervised processes be blocked only in the gen_server's main receive loop? I feel that receiving indefinitely is something I should avoid.  But how can I implement the queue in an OTP friendly way? S. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170302/4b404a22/attachment.html>


More information about the erlang-questions mailing list