[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Module for easy multithreading
- From: Hisham <h@...>
- Date: Fri, 29 Sep 2017 16:44:54 -0300
On 29 September 2017 at 15:05, Илья Удалов <firstname.lastname@example.org> wrote:
> Yes. Effil sets debug hook. Per 200 instructions by default.
> Yes. runner.step = 0 completely disable this hook.
> This hook insufficiently effects on performance. About 0.5 % with default value.
Well, since you replied on-list, I'll move the conversation on-list. :)
Wouldn't it be possible to leave the hook disabled by default and only enable it
when a thread calls thr:pause()? lua_sethook is async-safe so you'd only need
a lock to make sure that the state is not lua_close'd in the meantime (and not
to lock the actual execution of the thread).
(The lua.c interpreter does a roughly similar thing to forward a
cancellation request via the signal handler.)
Just throwing an idea out there!
> You also can add cancelation point effil.yield()
>> On 29 Sep 2017, at 20:53, Hisham <email@example.com> wrote:
>> A tiny off-list question, sorry for being lazy and not checking in the code:
>> the docs mention the runner.step function, which is specified in terms
>> of number of Lua instructions. Does that mean that every thread runs
>> with a debug hook plugged in by default? If so, did you notice any
>> performance impact in that? Does setting it to 0 fully disable the
>> Thank you for this library! I have used Lanes in the past but I got an
>> even better vibe from Effil's docs!
>> -- Hisham
>>> On 29 September 2017 at 10:13, Илья Удалов <firstname.lastname@example.org> wrote:
>>> Take a look at new gorgeous lua module for multithreading - Effil.
>>> Main feature are:
>>> - thread safe tables.
>>> - threads can be paused/resumed and canceled.
>>> - FIFO channels.
>>> Install it from luarocks: luarocks install effil
>>> Sources hosted on GitHub https://github.com/effil/effil
>>> Blog post about Effil:
>>> Ilia and Miha