Update of /cvsroot/q-lang/pd-qext
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14523
Modified Files:
pd.c
Log Message:
fix a deadlock between pd_send and q_tick, 2nd attempt
Index: pd.c
===================================================================
RCS file: /cvsroot/q-lang/pd-qext/pd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pd.c 11 Mar 2008 20:16:41 -0000 1.5
--- pd.c 11 Mar 2008 22:42:27 -0000 1.6
***************
*** 66,69 ****
--- 66,70 ----
pthread_cond_wait(&x->cond_init, &x->mut_init);
pthread_cleanup_pop(1);
+ newref(y);
release_lock();
pthread_mutex_lock(&x->mut_x);
***************
*** 76,83 ****
}
}
- acquire_lock();
if (n < x->a_xv) {
! x->xv[x->n_xv++] = newref(y);
pthread_mutex_unlock(&x->mut_x);
return mkvoid;
} else {
--- 77,84 ----
}
}
if (n < x->a_xv) {
! x->xv[x->n_xv++] = y;
pthread_mutex_unlock(&x->mut_x);
+ acquire_lock();
return mkvoid;
} else {
***************
*** 85,88 ****
--- 86,91 ----
fprintf(stderr, "pd_send(%s): buffer overflow (runaway thread?)\n",
x->args);
+ acquire_lock();
+ unref(y);
return __ERROR;
}
|