I object to the termination of running tasks. Note that it wouldn't be
possible to kill the thread immediately anyway, as this would potentially
corrupt the interpreter state; so the thread would need to come to a safe
point before dying.
Also, using the idle list doesn't work; there is a window in between the time
when you query the idle list and the time when you actually kill one of the
threads on it, and one of those threads could pick up a new task in the
interstitial time.
On Fri, 29 Apr 2022, 'Pascal Jasmin' via Beta wrote:
There does need to be a "delete thread command".
For simplicity it should terminate tasks on it. Can use the idle list to not
terminate a task.
I don't know if there is a need to compact thread id/numbers.
On Thursday, April 28, 2022, 10:28:36 p.m. EDT, Henry Rich <[email protected]> wrote:
I was enthusiastic about this proposal when I first saw it, but on
reflection, I have misgivings. The y argument to (0 T. y) is reserved
for thread parameters; with the proposal, how will thread parameters be set?
I think it would be better to leave the design as it is, to allow the
user complete control over the thread parameters.
Using 0&T.@''^:n'' will come to be seen as naive. Users will first
check the number of threads and then create what they need.
Henry Rich
On 4/28/2022 10:04 PM, Elijah Stone wrote:
(If more than y threads are already doing work when 0 T.y is issued,
then the extraneous threads should exit as soon as they are finished;
this should be completely transparent. Thread count is a hint; it
should not affect semantics except in a buggy program.)
On Thu, 28 Apr 2022, Elijah Stone wrote:
Current interface for creating threads is 0 T.''. I find this
interface problematic for a couple of reasons:
1. Pretty much every j script I have seen anyone write is headed by
something like 0&T.@''^:n'', where n is the desired number of threads
to create. I haven't ever seen anyone call 0 T.'' directly by hand,
and I don't think there is ever a good reason to do that.
0&T.@''^:n'' is cumbersome and not particularly clear.
2. There is no mechanism to reduce the number of threads.
3. (This was pointed out by somebody else:) if a script is headed by
0&T.@''^:n'', then every time that script is reloaded, n _new_
threads will be created, which is probably not desirable behaviour.
I therefore suggest that the threading interface be changed so that 0
T.y ensures that there are y threads, creating or destroying threads
as needed.
Question: should y be the overall number of threads, or the number of
threads on top of the master thread? If the former, should 0 T.0 be
punned to exit the session (i.e. kill all threads, including the
master thread)?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm