Date: Tue, 20 Oct 98 08:30:30 -0500 From: "Richard Seaman, Jr." <lists@tar.com> To: "HighWind Software Information" <info@highwind.com> Cc: "current@freebsd.org" <current@FreeBSD.ORG> Subject: Re: Another Serious libc_r problem Message-ID: <199810201330.IAA09508@ns.tar.com>
next in thread | raw e-mail | index | archive | help
On Tue, 20 Oct 98 08:01:12 -0500, Richard Seaman, Jr. wrote:
>I will try to look at this later, if I have time. However, there are
>others who know a lot more about this than I do who could probably
>do a better fix.
You could try the following patch. However, someone else should look at
it too before its committed.
*** uthread_cond.c.orig Tue Oct 20 08:13:58 1998
--- uthread_cond.c Tue Oct 20 08:21:31 1998
***************
*** 137,144 ****
*/
else if (*cond != NULL ||
(rval = pthread_cond_init(cond,NULL)) == 0) {
- /* Lock the condition variable structure: */
- _SPINLOCK(&(*cond)->lock);
/* Process according to condition variable type: */
switch ((*cond)->c_type) {
--- 137,142 ----
***************
*** 148,154 ****
--- 146,156 ----
* Queue the running thread for the condition
* variable:
*/
+
+ /* Lock the condition variable structure: */
+ _SPINLOCK(&(*cond)->lock);
_thread_queue_enq(&(*cond)->c_queue, _thread_run);
+ _SPINUNLOCK(&(*cond)->lock);
/* Unlock the mutex: */
pthread_mutex_unlock(mutex);
***************
*** 156,171 ****
/* Wait forever: */
_thread_run->wakeup_time.tv_sec = -1;
- /* Unlock the condition variable structure: */
- _SPINUNLOCK(&(*cond)->lock);
/* Schedule the next thread: */
_thread_kern_sched_state(PS_COND_WAIT,
__FILE__, __LINE__);
- /* Lock the condition variable structure: */
- _SPINLOCK(&(*cond)->lock);
-
/* Lock the mutex: */
rval = pthread_mutex_lock(mutex);
break;
--- 158,168 ----
***************
*** 177,184 ****
break;
}
- /* Unlock the condition variable structure: */
- _SPINUNLOCK(&(*cond)->lock);
}
/* Return the completion status: */
--- 174,179 ----
***************
*** 201,208 ****
*/
else if (*cond != NULL ||
(rval = pthread_cond_init(cond,NULL)) == 0) {
- /* Lock the condition variable structure: */
- _SPINLOCK(&(*cond)->lock);
/* Process according to condition variable type: */
switch ((*cond)->c_type) {
--- 196,201 ----
***************
*** 219,225 ****
--- 212,221 ----
* Queue the running thread for the condition
* variable:
*/
+ /* Lock the condition variable structure: */
+ _SPINLOCK(&(*cond)->lock);
_thread_queue_enq(&(*cond)->c_queue, _thread_run);
+ _SPINUNLOCK(&(*cond)->lock);
/* Unlock the mutex: */
if ((rval = pthread_mutex_unlock(mutex)) != 0) {
***************
*** 228,245 ****
* running thread from the condition
* variable queue:
*/
_thread_queue_deq(&(*cond)->c_queue);
} else {
- /* Unlock the condition variable structure: */
- _SPINUNLOCK(&(*cond)->lock);
/* Schedule the next thread: */
_thread_kern_sched_state(PS_COND_WAIT,
__FILE__, __LINE__);
- /* Lock the condition variable structure: */
- _SPINLOCK(&(*cond)->lock);
-
/* Lock the mutex: */
if ((rval = pthread_mutex_lock(mutex)) != 0) {
}
--- 224,238 ----
* running thread from the condition
* variable queue:
*/
+ _SPINLOCK(&(*cond)->lock);
_thread_queue_deq(&(*cond)->c_queue);
+ _SPINUNLOCK(&(*cond)->lock);
} else {
/* Schedule the next thread: */
_thread_kern_sched_state(PS_COND_WAIT,
__FILE__, __LINE__);
/* Lock the mutex: */
if ((rval = pthread_mutex_lock(mutex)) != 0) {
}
***************
*** 258,265 ****
break;
}
- /* Unlock the condition variable structure: */
- _SPINUNLOCK(&(*cond)->lock);
}
/* Return the completion status: */
--- 251,256 ----
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810201330.IAA09508>
