UnviersalQueue and Thread producer backpressure



So I was wondering, if I have have a thread that produces messages and forwards them continuously to a curio layer using the UniversalQueue, is there any elegant way to support something like backpressure for this?

Basically the situation is, that the thread worker has its own queue for backpressure, but this does not have any idea about the curio layer, which does not check for the max_size thing when you put data from a thread into a UniversalQeue? Maybe having a lock between the two would help? Is this not a proper usecase maybe?

I am fairly new to curio, so excuse any misconceptions in the question.


I’m not entirely sure I understand the scenario without seeing more code. UniversalQueue does have a maxsize argument. Is something more than this needed?