Has there been any decision yet over what model(s) of threads perl6
will support?

Will they be POSIX-like? ithread-like? green-thread-like?

It is my hope that more than one model will be supported... something
that would allow the most lightweight threads possible to be used
where possible, and ithread-like behavior for backwards compatibility,
and perhaps something in-between where the lightest threads won't
work, but ithreads are too slow.

If perl6 can statically (at compile time) analyse subroutines and
methods and determine if they're reentrant, then it could
automatically use the lightest weight threads when it knows that the
entry sub won't have side effects or alter global data.

If an otherwise-reentrant subroutine calls other subs which have been
labelled by their authors as thread-safe, then that top subroutine can
also be assumed to be thread-safe.  This would be when the
intermediate weight threads might be used.

If thread-unsafe subroutines are called, then something like ithreads
might be used.

To allow the programmer to force perl6 to use lighter threads than it
would choose by static analysis, he should be able to declare methods,
subs, and blocks to be reentrant or threads safe, even if they don't
look that way to the compiler.  Of course, he would be doing so at his
own risk, but he should be allowed to do it (maybe with a warning).

Reply via email to