Skip to content

Commit ca06740

Browse files
committed
workaround jtjsleep lock up on windows
1 parent 39f1693 commit ca06740

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/gtdot.ijs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ NB. T. t. ------------------------------------------------------------------
44
NB. **************************************** threads & tasks **********************************
55
NB. j904 64-bit only
66

7+
3 : 0''
8+
if. IFWIN do.
9+
sleep=: usleep@>.@(1e6&*)
10+
else.
11+
sleep=: 6!:3
12+
end.
13+
1
14+
)
15+
716
NB. wait until there are y waiting threads
817
wthr=: {{ while. y ~: {. 2 T.'' do. 6!:3]0.001 end. 1 }}
918
delth =: {{ while. 1 T. '' do. 55 T. '' end. 1 }} NB. delete all worker threads
@@ -72,14 +81,14 @@ echo^:(PRINTMSG+.GITHUBCI*.IFWIN) 'test ',(":1),' f2 ',(":y),' finish: ',":6!:0'
7281

7382
g=: 3 : 0
7483
9!:1[(7^5)+3 T.'' NB. random per thread
75-
6!:3[0.001*?0 NB. arbitrary delay
84+
sleep[0.001*?0 NB. arbitrary delay
7685
1
7786
)
7887

7988
g1=: 4 : 0
8089
9!:1[(7^5)-3 T.'' NB. random per thread
8190
for_i. i.y do.
82-
6!:3[0.001*?0 NB. arbitrary delay
91+
sleep[0.001*?0 NB. arbitrary delay
8392
pyx=. g t. (<'worker';x) "0 i.y
8493
end.
8594
]&> pyx
@@ -254,7 +263,7 @@ amv =. 16 T. 0 NB. AMV with value 0
254263
'limit error' -: 2 T. etx 8
255264
'limit error' -: ". etx '] t. 8'
256265

257-
4!:55 ;:'allowlongjobs amv delth N N1 N2 f f1 f2 g g1 wthr'
266+
4!:55 ;:'allowlongjobs amv delth N N1 N2 f f1 f2 g g1 wthr sleep'
258267

259268
epilog''
260269

0 commit comments

Comments
 (0)