From owner-freebsd-current Tue Oct 20 06:31:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA17077 for freebsd-current-outgoing; Tue, 20 Oct 1998 06:31:04 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from ns.tar.com (ns.tar.com [204.95.187.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA17072 for ; Tue, 20 Oct 1998 06:31:02 -0700 (PDT) (envelope-from lists@tar.com) Received: from ppro.tar.com (ppro.tar.com [204.95.187.9]) by ns.tar.com (8.9.1/8.8.7) with SMTP id IAA09508; Tue, 20 Oct 1998 08:30:30 -0500 (CDT) Message-Id: <199810201330.IAA09508@ns.tar.com> From: "Richard Seaman, Jr." To: "HighWind Software Information" Cc: "current@freebsd.org" Date: Tue, 20 Oct 98 08:30:30 -0500 Reply-To: "Richard Seaman, Jr." X-Mailer: PMMail 1.92 For OS/2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Subject: Re: Another Serious libc_r problem Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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