Philippe Sigaud <philippe.sig...@gmail.com> wrote:

- Why is a 2 threads version repeatedly thrice as fast as a no thread version?
I thought it'd be only twice as fast.

No idea.


- 1024 threads are OK, but I cannot reach 2048. Why? What is the limit for the number of spawn I can do? Would that be different if each threads spawn two
sub-threads instead of the main one generating 2048?

How many can you do, and what happens when you can't make more?


- What is the official way to verify that all threads are done? As you can
see, I used a while loop, but I'm reaching in the dark, there.

Tids pass a message of type MsgType.LinkDead when they close.
I'm not entirely sure how to check this, as I have no experience with
std.concurrency.

There is also thread_joinAll in core.thread, which "Joins all non-daemon
threads that are currently running."


- I have to read TDPL again: in thread, is there any way to get the Tid of the
thread that spawned you apart from waiting for it to send its Tid?

No. However, there is a private TLS variable in std.concurrency that
refers to the Tid of the owner thread.

Also, you could consider sending it as part of the function parameters.


- is there any way to broadcast a message to a list of threads?

Nope. Well, of course, one could make a function what does it.

--
Simen

Reply via email to