On Mon, 14 Jan 2019 20:34:59 +0100, Sönke Ludwig wrote:
Am 02.01.2019 um 10:38 schrieb Mengu:
The direct equivalent would be
vibe.core.sync.LocalManualEvent
(created withcreateManualEvent
). The semantics have changed a bit, so
that thesignal.acquire() ... rawYield() ... signal.release()
sequence
becomes justsignal.wait()
.The original code also doesn't use the wait counter, which is necessary
to guarantee race-condition free waiting, so the code should be adjusted
further by doingcounter = signal.wait(counter);
(counter being anint
initially set to zero), which makes sure thatwait
doesn't block
ifemit
has already been called in the meantime.There are also two alternatives that could also be used for waiting -
InterruptibleTaskCondition
(a normal condition variable) andstd.concurrency
(message passing). The former is combined with a mutex
and could be used to make the code robust against multiple tasks trying
to send data at the same time.
thank you very much sonke. i'll give these a try.