lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Looks like a nice library but I'll have to give it a miss because of the unchecked mallocs.

    struct queue *q = malloc(sizeof(*q));
    // malloc never failed

In my experience malloc does fail and quite often when running on a system with constrained memory. I see a lot of code with unchecked mallocs on github and I don't like it. If it's too much effort to check return values why not just wrapper malloc/calloc so OOM failures set a message and exit cleanly? Of course, it's not just open source code that has this issue. I've raised many tickets for expensive enterprise software with the same problem.

On 29/04/2015 4:46 PM, 云风 wrote:
I wrote a new multi tasking library for lua these days, it still work
in process, but I'm pleased to announce here to get more feedback :)

The core of the library is a m:n schedule , it maps m task (one lua
state per task) to n os thread. (In windows, it uses windows native
threading api, otherwise it uses pthead)

No data can be shared among lua states , the only way for cooperative
is the build-in channels .

ltask has no facility like timer, blocked I/O, etc. but I think it's
easy to use other library (like levent
on it.