--- ghostscript-9.00/base/gp_psync.c Wed Jul 28 14:52:49 2010
+++ ghostscript-9.00/base/gp_psync.c Fri Sep 9 12:12:13 2011
@@ -62,13 +62,18 @@
{
pt_semaphore_t * const sem = (pt_semaphore_t *)sema;
int scode;
+ pthread_mutex_t tmp_mutex;
+ pthread_cond_t tmp_cond;
if (!sema)
return -1; /* semaphores are not movable */
sem->count = 0;
- scode = pthread_mutex_init(&sem->mutex, NULL);
- if (scode == 0)
- scode = pthread_cond_init(&sem->cond, NULL);
+ scode = pthread_mutex_init(&tmp_mutex, NULL);
+ memcpy(&sem->mutex, &tmp_mutex, sizeof(pthread_mutex_t));
+ if (scode == 0) {
+ scode = pthread_cond_init(&tmp_cond, NULL);
+ memcpy(&sem->cond, &tmp_cond, sizeof(pthread_cond_t));
+ }
return SEM_ERROR_CODE(scode);
}
@@ -147,6 +152,7 @@
gp_monitor_open(gp_monitor * mona)
{
pthread_mutex_t *mon;
+ pthread_mutex_t tmp_mutex;
int scode;
if (!mona)
@@ -153,7 +159,8 @@
return -1; /* monitors are not movable */
mon = &((gp_pthread_recursive_t *)mona)->mutex;
((gp_pthread_recursive_t *)mona)->self_id = 0; /* Not valid unless mutex is locked */
- scode = pthread_mutex_init(mon, NULL);
+ scode = pthread_mutex_init(&tmp_mutex, NULL);
+ memcpy(mon, &tmp_mutex, sizeof(pthread_mutex_t));
return SEM_ERROR_CODE(scode);
}