Love thread wrapper

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
HDPLocust
Citizen
Posts: 65
Joined: Thu Feb 19, 2015 10:56 pm
Location: Swamp
Contact:

Love thread wrapper

Post by HDPLocust » Sun May 14, 2017 9:43 pm

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:
Attachments
Thread ring.love
(4.3 KiB) Downloaded 137 times
Last edited by HDPLocust on Mon May 15, 2017 9:17 am, edited 2 times in total.
Science and violence

User avatar
zorg
Party member
Posts: 3044
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Love thread wrapper

Post by zorg » 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
HDPLocust
Citizen
Posts: 65
Joined: Thu Feb 19, 2015 10:56 pm
Location: Swamp
Contact:

Re: Love thread wrapper

Post by HDPLocust » Sun May 14, 2017 10:12 pm

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.
Last edited by HDPLocust on Sun May 14, 2017 10:20 pm, edited 1 time in total.
Science and violence

User avatar
zorg
Party member
Posts: 3044
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Love thread wrapper

Post by zorg » Sun May 14, 2017 10:19 pm

Oh, my mistake then! Apologies. :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: Love thread wrapper

Post by airstruck » 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.

User avatar
HDPLocust
Citizen
Posts: 65
Joined: Thu Feb 19, 2015 10:56 pm
Location: Swamp
Contact:

Re: Love thread wrapper

Post by HDPLocust » Wed May 17, 2017 8:39 am

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.
Science and violence

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests