[m-rev.] diff: fix thread debugging bugs

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Mar 4 03:27:54 AEDT 2003


Pete, I didn't notice when I reviewed your change that you were planning
to commit it on the release branch.  This is a new feature, so it is
not appropriate for the release branch.  There's too much danger of
introducing bugs, such as the ones below.  I will back your change out
on the release branch, and (attempt to) fix the bugs only on the main branch.

Estimated hours taken: 0.25
Branches: main

Fix bugs in Pete's last change.

runtime/mercury_wrapper.c:
	#include "mercury_thread.h", since this file references
	MR_debug_threads which is declared there.

runtime/mercury_thread.h:
	Move the declarations of MR_mutex_* and MR_cond_*
	inside `#if MR_THREAD_SAFE', since they refer to
	the MercuryLock and MercuryCond types which are only
	defined in the MR_THREAD_SAFE case.

Workspace: /home/ceres/fjh/mercury
Index: runtime/mercury_thread.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_thread.h,v
retrieving revision 1.11.2.2
diff -u -d -r1.11.2.2 mercury_thread.h
--- runtime/mercury_thread.h	3 Mar 2003 14:55:07 -0000	1.11.2.2
+++ runtime/mercury_thread.h	3 Mar 2003 16:20:34 -0000
@@ -28,6 +28,11 @@
   typedef pthread_mutex_t	MercuryLock;
   typedef pthread_cond_t	MercuryCond;
 
+  void MR_mutex_lock(MercuryLock *lock, const char *from);
+  void MR_mutex_unlock(MercuryLock *lock, const char *from);
+  void MR_cond_signal(MercuryCond *cond);
+  void MR_cond_wait(MercuryCond *cond, MercuryLock *lock);
+
   #ifndef MR_DEBUG_THREADS
 	/*
 	** The following macros should be used once the
@@ -172,10 +177,5 @@
 */
 
 extern	void    MR_finalize_thread_engine(void);
-
-void MR_mutex_lock(MercuryLock *lock, const char *from);
-void MR_mutex_unlock(MercuryLock *lock, const char *from);
-void MR_cond_signal(MercuryCond *cond);
-void MR_cond_wait(MercuryCond *cond, MercuryLock *lock);
 
 #endif
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.114.2.1
diff -u -d -r1.114.2.1 mercury_wrapper.c
--- runtime/mercury_wrapper.c	3 Mar 2003 14:55:07 -0000	1.114.2.1
+++ runtime/mercury_wrapper.c	3 Mar 2003 16:24:38 -0000
@@ -49,6 +49,7 @@
 #include	"mercury_deep_profiling.h"
 #include	"mercury_memory.h"		/* for MR_copy_string() */
 #include	"mercury_memory_handlers.h"	/* for MR_default_handler */
+#include	"mercury_threads.h"		/* for MR_debug_threads */
 
 /* global variables concerned with testing (i.e. not with the engine) */
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list