Page 1 of 1

Luaseq - Asynchronous helper library

Posted: Sun Mar 01, 2020 4:47 pm
by Imagic
Here is another library I extensively use in my Lua projects.

It's very simple and maybe hard to see how useful it can be. It's an abstraction layer on top of Lua coroutines to express asynchronous tasks in a simpler way (at least for me).

Coroutines are amazing and prevent stuff like callbacks hell; Luaseq exploits that and helps to write messy asynchronous dependencies.
For example, if we need to download a resource before being able to use it and multiple elements require it, they may wait on the same task to complete.

Project and documentation: https://github.com/ImagicTheCat/Luaseq

Re: Luaseq - Asynchronous helper library

Posted: Sun Mar 01, 2020 8:06 pm
by monolifed
This might be confused with luasec

Re: Luaseq - Asynchronous helper library

Posted: Tue Oct 20, 2020 7:55 am
by Guard13007
monolifed wrote: Sun Mar 01, 2020 8:06 pm This might be confused with luasec
I literally only opened this because I thought it was for this. Author, please consider renaming it

Re: Luaseq - Asynchronous helper library

Posted: Tue Oct 20, 2020 3:07 pm
by Imagic
I had interesting names for the library, but all were already taken. Similar is better than identical, at least computers understand the difference. Also, changing a project's name requires more than a little inconvenience.

Re: Luaseq - Asynchronous helper library

Posted: Fri Oct 30, 2020 6:12 pm
by YounYokel
you could use uppercase

Re: Luaseq - Asynchronous helper library

Posted: Thu Nov 18, 2021 3:25 pm
by Imagic
Released version 1.1.

It features better error propagation and mutexes.

Re: Luaseq - Asynchronous helper library

Posted: Thu Nov 18, 2021 4:28 pm
by grump
Imagic wrote: Thu Nov 18, 2021 3:25 pm mutexes
Just to be clear: this is about coroutines, where by definition no actual concurrency can happen? No "real" mutexes that could be used to synchronize threads?

Re: Luaseq - Asynchronous helper library

Posted: Thu Nov 18, 2021 4:41 pm
by Imagic
"Real" doesn't mean much. Lua coroutines are VM threads, and what are commonly called threads are system threads.

Those mutexes are for VM threads, where there is concurrency, but not at the same level. E.g. think about a computer where there are system threads, but a single core, no instruction parallelism: it is still concurrent, scheduled by the kernel. Mutexes are a synchronization mechanism, in this case for the VM, at a higher level of abstraction.

Re: Luaseq - Asynchronous helper library

Posted: Thu Nov 18, 2021 8:12 pm
by grump
Maybe I should have been clearer with my question. I looked at the code and I understand that it's not usable with preemptive threads.

Re: Luaseq - Asynchronous helper library

Posted: Thu Nov 18, 2021 10:09 pm
by pgimeno
For preemptive thread mutexes there's already https://github.com/slime73/love-mutex