HaxeFoundation / HaxeFoundation/haxe

Thread API

Open
#12,563 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Just found out about #12547 and not very happy with the result : the code looks even more messy and I don't see this solving any actual problem. I understand that ideally maybe the two should be decoupled but if the resulting code is more ugly than with coupling then I don't see the point.

Also for the record, onJobDone and onExit are not working well as the thread might have finished the job by the time these are called by the parent thread. This is bad API design, I was about to fix a similar issue with onAbort being dynamic. And having all these functions in Thread.create parameters is wrong.

We should have instead:

Thread.create(run,{ ?onStart : ..., ?onExit : , ?onAbort : ))

and not allow these to be changed in the Thread instance.

Also, if the start function register is meant to be used by inner systems only (EventLoop), please keep it private, or else it needs to be complete with add/remove functionalities if public, and as well for static thread end/exit but i feel it's too much.

Ping @Simn @yuxiaomao

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.