Luaseq - Asynchronous helper library

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Imagic
Prole
Posts: 44
Joined: Mon Sep 30, 2019 8:20 am
Contact:

Luaseq - Asynchronous helper library

Post 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
monolifed
Party member
Posts: 188
Joined: Sat Feb 06, 2016 9:42 pm

Re: Luaseq - Asynchronous helper library

Post by monolifed »

This might be confused with luasec
User avatar
Guard13007
Party member
Posts: 132
Joined: Sat Oct 25, 2014 3:42 am
Location: Internet, USA
Contact:

Re: Luaseq - Asynchronous helper library

Post 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
User avatar
Imagic
Prole
Posts: 44
Joined: Mon Sep 30, 2019 8:20 am
Contact:

Re: Luaseq - Asynchronous helper library

Post 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.
User avatar
YounYokel
Prole
Posts: 39
Joined: Thu Oct 03, 2019 5:57 pm

Re: Luaseq - Asynchronous helper library

Post by YounYokel »

you could use uppercase
User avatar
Imagic
Prole
Posts: 44
Joined: Mon Sep 30, 2019 8:20 am
Contact:

Re: Luaseq - Asynchronous helper library

Post by Imagic »

Released version 1.1.

It features better error propagation and mutexes.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Luaseq - Asynchronous helper library

Post 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?
User avatar
Imagic
Prole
Posts: 44
Joined: Mon Sep 30, 2019 8:20 am
Contact:

Re: Luaseq - Asynchronous helper library

Post 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.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Luaseq - Asynchronous helper library

Post 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.
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: Luaseq - Asynchronous helper library

Post by pgimeno »

For preemptive thread mutexes there's already https://github.com/slime73/love-mutex
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 47 guests