Page 1 of 1

Love thread wrapper

Posted: Sun May 14, 2017 9:43 pm
by HDPLocust
Here cool and easy wrapper for love threads, used some like actor model.
Every channel use full-duplex connection to main and other threads.

Reference here:
https://bitbucket.org/MainTomato/toolch ... ?at=master

Looped message passing example:

Re: Love thread wrapper

Posted: Sun May 14, 2017 10:04 pm
by zorg
You really should have mentioned this tidbit:
Thread library for LOVE2d v0.8
Unless that's not true, that is. But yeah, 2, almost 3 versions behind the current.

Re: Love thread wrapper

Posted: Sun May 14, 2017 10:12 pm
by HDPLocust
zorg wrote: Sun May 14, 2017 10:04 pm You really should have mentioned this tidbit:
Thread library for LOVE2d v0.8
Unless that's not true, that is. But yeah, 2, almost 3 versions behind the current.
Oh, it works for love v0.9 - 0.10.2.
v0.8 is library version.
Thanks, readme updated.

Re: Love thread wrapper

Posted: Sun May 14, 2017 10:19 pm
by zorg
Oh, my mistake then! Apologies. :3

Re: Love thread wrapper

Posted: Tue May 16, 2017 7:42 pm
by airstruck
Is newproxy really necessary? Couldn't __gc be set on the thread userdata instead of the table it's in?

If that doesn't work, at least localize setmetatable so the library won't overwrite the global setmetatable.

Re: Love thread wrapper

Posted: Wed May 17, 2017 8:39 am
by HDPLocust
airstruck wrote: Tue May 16, 2017 7:42 pm Is newproxy really necessary? Couldn't __gc be set on the thread userdata instead of the table it's in?

If that doesn't work, at least localize setmetatable so the library won't overwrite the global setmetatable.
Yes, i think about fix it. Newproxy works, and setmetatable will not be overwritten in next release.
But now, for average using threads, is okay.