Skip to content

Commit c16b927

Browse files
committed
fix mutexes + gtdot test
1 parent c3313e3 commit c16b927

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

jsrc/mt.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ static inline I jtpthread_mutex_timedlock(J jt,jtpthread_mutex_t *m,UI ns,I self
3434
static inline I jtpthread_mutex_trylock(jtpthread_mutex_t *m,I self){
3535
I4 r=pthread_mutex_trylock(m);
3636
if(!r)R 0;
37-
if(r==ETIMEDOUT)R -1;
37+
if(r==EBUSY)R -1;
38+
if(r==EAGAIN)R EVLIMIT; //'max recursive locks exceeded'
3839
if(r==EDEADLK||r==EOWNERDEAD)R EVCONCURRENCY;
3940
R EVFACE;}
4041
static inline C jtpthread_mutex_unlock(jtpthread_mutex_t *m,I self){

test/gtdot.ijs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,14 @@ assert. remote_stuff=2
282282
assert. remote_stuff=4
283283
NB. mutex
284284
mtx =. 10 T. 0
285-
0 = >{{11 T. mtx;0}}t.''0
285+
0 = >{{11 T. y;0}}t.''mtx
286286
1 = 11 T. mtx;0
287287
mtx =. 10 T. 0
288288
0 = 11 T. mtx
289289
'domain error' -: 11 T. etx >: mtx
290-
13 T. mtx
291290
mtx =. 10 T. 0
292291
tod =. 6!:1''
293-
0 = >{{11 T. <mtx}}t.''0 NB. boxed mtx OK
292+
0 = >{{11 T. <y}}t.''mtx NB. boxed mtx OK
294293
1 = 11 T. mtx;2.0
295294
(2.005 > dly) *. 2 <: dly =. tod-~6!:1'' NB. verify delay
296295
tod =. 6!:1''
@@ -299,7 +298,6 @@ tod =. 6!:1''
299298
tod =. 6!:1''
300299
1 = 11 T. mtx;0
301300
(0.005 > dly) *. 0 <: dly =. tod-~6!:1'' NB. verify no delay
302-
13 T. mtx
303301
mtx=.10 T. 1 NB. recursive
304302
0 = 11 T. mtx
305303
0 = 11 T. mtx NB. lock count=2

0 commit comments

Comments
 (0)