A scheduled control signal with fibers?

Ferhat Kurtulmuş aferust at gmail.com
Fri Sep 25 13:16:24 UTC 2020


On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe 
wrote:
> On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş 
> wrote:
>> [...]
>
> No need for fibers per se.
>
> You can run 2 threads. One that produces {time: now + 
> 1500.msecs, value: getFlameIntensityViaImageProcessing} objects 
> and one that consumes those and basically waits until each's 
> msg.time < now and then sendPWMSignalToValfe(msg.value). You 
> would basically rely on std.concurrency's MessageBox to do the 
> queuing. Although you could do that manually as well.
>
> Could also run it on 1 thread if you don't mind there being a 
> jitter of however long getFlameIntensityViaImageProcessing 
> takes, but you will need a queue.

That was the first thing I thought. A FIFO queue. I just wanted 
to not reinvent the wheel. So, you guys say go for regular 
threads not fibers. Thank you.


More information about the Digitalmars-d-learn mailing list