File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -122,12 +122,13 @@ end.
122122if. IF64 do.
123123assert. (< @ i. " 0 i. 5 ) -: (i. t. ' ' " 0 i. 5 )
124124assert. 2 <: 1 T. ' '
125- while. 2 > # 2 T. ' ' do. end. NB. wait till threads become ready
126- assert. 1 2 *. / @ e. 2 T. ' '
127- assert. 0 1 2 *. / @ e. > (3 & T. @ ' ' )@ (6 !: 3 ) t. ' ' " (0 ) 0.1 0.1 0.3
128- assert. 0 1 2 *. / @ e. > (3 & T. @ ' ' )@ (6 !: 3 ) t. ' ' " (0 ) 0.3 0.3 0.1
129- assert. (_1000 ; 1 2 ; _1001 ) e. ~ & > 4 T. (3 & T. @ ' ' )@ (6 !: 3 ) t. ' ' " (0 ) 0.2 0.6 0.4
130- while. 2 ~: # 2 T. ' ' do. end. NB. wait till threads become ready
125+ nwthreads=. 1 T. ' '
126+ while. nwthreads ~: # 2 T. ' ' do. end. NB. wait till threads become ready
127+ assert. (>: i. nwthreads) *. / @ e. 2 T. ' '
128+ assert. (>: i. nwthreads) *. / @ e. > (3 & T. @ ' ' )@ (6 !: 3 ) t. ' ' " (0 ) (nwthreads # 0.1 ), 0.3
129+ assert. (>: i. nwthreads) *. / @ e. > (3 & T. @ ' ' )@ (6 !: 3 ) t. ' ' " (0 ) (nwthreads # 0.3 ), 0.1
130+ assert. (((< _1000 ) # ~ <: nwthreads), (>: i. nwthreads); _1001 ) e. ~ & > 4 T. (3 & T. @ ' ' )@ (6 !: 3 ) t. ' ' " (0 ) (0.3 # ~ <: nwthreads), 0.6 0.4
131+ while. nwthreads ~: # 2 T. ' ' do. end. NB. wait till threads become ready
131132NB. semaphore test
132133localpyx=.5 T. 5
133134g t. ' ' localpyx;< 1
Original file line number Diff line number Diff line change @@ -50,14 +50,14 @@ assert. r e. _1000 _1001 NB. _1001 if run on the main thread
5050
5151g=: 3 : 0
52529 !: 1 [ (7 ^ 5 )+ 3 T. ' ' NB. random per thread
53- 6 !: 3 [? 0 NB. arbitrary delay
53+ 6 !: 3 [ 0.3 * ?0 NB. arbitrary delay
54541
5555)
5656
5757g1=: 3 : 0
58589 !: 1 [ (7 ^ 5 )- 3 T. ' ' NB. random per thread
5959for_i. i.%: N1 do.
60- 6 !: 3 [? 0
60+ 6 !: 3 [ 0.3 * ?0
6161 pyx=. g t. ' ' " 0 i.%: N1
6262end.
6363] & > pyx
You can’t perform that action at this time.
0 commit comments