This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygserver 100% CPU (was: References to both cygwin1.dll and msvcrt.dl


On Sep 30 23:41, Patrick Samson wrote:
> Now, when it's wrong, I can see:
>   good morning (error=4)!
> Error 4 is EINTR on the return of msleep().
> Subsequently semop() returns with this EINTR.

Are you set up to build cygwin?  If so, could you please test the
following patch to cygserver and if it changes anything for you?


Thanks,
Corinna


Index: winsup/cygserver/sysv_sem.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygserver/sysv_sem.cc,v
retrieving revision 1.3
diff -p -u -r1.3 sysv_sem.cc
--- winsup/cygserver/sysv_sem.cc	2 Mar 2004 11:08:35 -0000	1.3
+++ winsup/cygserver/sysv_sem.cc	1 Oct 2004 11:02:49 -0000
@@ -1111,15 +1111,6 @@ semop(struct thread *td, struct semop_ar
 		    "semwait", 0);
 		DPRINTF(("semop:  good morning (error=%d)!\n", error));
 
-		if (error != 0) {
-#ifdef __CYGWIN__
-		    if (error != EIDRM)
-#endif /* __CYGWIN__ */
-			error = EINTR;
-			goto done2;
-		}
-		DPRINTF(("semop:  good morning!\n"));
-
 		/*
 		 * Make sure that the semaphore still exists
 		 */
@@ -1137,6 +1128,20 @@ semop(struct thread *td, struct semop_ar
 			semptr->semzcnt--;
 		else
 			semptr->semncnt--;
+
+		/*
+		 * Is it really morning, or was our sleep interrupted?
+		 * (Delayed check of msleep() return code because we
+		 * need to decrement sem[nz]cnt either way.)
+		 */
+		if (error != 0) {
+#ifdef __CYGWIN__
+		    if (error != EIDRM)
+#endif /* __CYGWIN__ */
+			error = EINTR;
+			goto done2;
+		}
+		DPRINTF(("semop:  good morning!\n"));
 	}
 
 done:

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          mailto:cygwin@cygwin.com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]