Fibers and async io stuff for beginners

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 23 12:24:30 PDT 2015


On Thursday, 23 April 2015 at 16:57:30 UTC, Jens Bauer wrote:
> On Thursday, 23 April 2015 at 14:22:01 UTC, Ali Çehreli wrote:
>> On 04/23/2015 06:56 AM, ref2401 wrote:
>>  http://ddili.org/ders/d.en/fibers.html
>>
>> I appreciate any feedback before the book is finally printed 
>> sometime before DConf.
>
> This is great information. I didn't know anything about Fibers 
> before today.
> Since I started looking at D, I've seen many new and innovative 
> ways of programming.
> Fibers are definitely also beneficial for microcontrollers.
> I can think of a few things that would make good use of Fibers:
> 1: Real-time Video decompression.
> 2: File decompression in general.
> 3: Audio mixing and playback (eg. a MOD player for instance).
> 4: Collecting data from external devices and sensors.
> 5: Queueing up a bunch of different jobs; for instance copying 
> files (everyone probably knows by now not to start copying 
> files if already copying files).
>
> ... Thinking a bit further, I've sometimes wanted to make 
> multiple cores work on fetching jobs from the same queue. Would 
> Fibers be good for spreading out jobs this way?
> Actually, it would be neat to have a class, which could manage 
> job-dependencies, so that all CPUs could be made busy without 
> having to make things look complicated. Someone probably made 
> this already, though. ;)

At the moment I'm using threads to implement a speech 
synthesizer. It waits for input, synthesizes it, and then 
"speaks" in a separate thread. If new input comes, the speaking 
thread is stopped. I wonder, if fibers would be a viable 
alternative to threads (after all audio playback was mentioned in 
the list above).


More information about the Digitalmars-d-learn mailing list