I am pretty sure it is a deadlock. Here's an alternate expression which
requires no delay:
a=: {{> b=: >t.''a}}t.'' 0
>a
[hang]
As I see it, a cannot make progress until b finishes (because a is waiting
for b), but b cannot make progress until a finishes (because b is waiting
for a), and since it is necessary for a running thread to make progress
before it can finish, neither a nor b can make progress.
On Wed, 13 Apr 2022, Henry Rich wrote:
I don't think this is a deadlock. It's just an infinite recursion, made
painfully slow by the delay.
Every task is started with enough resources to finish the task. As long
as the OS has some way to ensure that no task will starve, deadlock
should be impossible.
That was my reasoning when I designed this. I sure hope it's right.
Henry Rich
On 4/13/2022 1:12 AM, Elijah Stone wrote:
a=: {{> ". 'b' [ 6!:3]2}} t.'' 0
b=: {{> ". 'a' [ 6!:3]2}} t.'' 0
>a
[hang]
actually, it's enough to make it wait on itself:
a=: {{> ". 'a' [ 6!:3]2}}t.'' 0
>a
[hang]
Probably it should be an error. E.G. pthread_join will return EDEADLK
when it encounters an analogous situation.
----------------------------------------------------------------------
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