[m-rev.] diff: extras/concurrency/semaphore.m

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Jun 25 14:13:40 AEST 2001


Can anyone explain why code in the extras directory has this kind of low-level
knowledge of the runtime system?

extras/concurrency/semaphore.m:
	Add missing MR_ prefixes.

Zoltan.

cvs diff: Diffing .
Index: semaphore.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/concurrency/semaphore.m,v
retrieving revision 1.8
diff -u -b -r1.8 semaphore.m
--- semaphore.m	2000/11/23 01:59:51	1.8
+++ semaphore.m	2001/06/23 11:15:28
@@ -155,18 +155,20 @@
 		MR_UNLOCK(&(sem->lock), ""semaphore__signal"");
 		MR_schedule(ctxt);
 			/* yield() */
-		MR_save_context(MR_ENGINE(this_context));
-		MR_ENGINE(this_context)->resume = &&signal_skip_to_the_end_1;
-		MR_schedule(MR_ENGINE(this_context));
+		MR_save_context(MR_ENGINE(MR_eng_this_context));
+		MR_ENGINE(MR_eng_this_context)->resume =
+			&&signal_skip_to_the_end_1;
+		MR_schedule(MR_ENGINE(MR_eng_this_context));
 		MR_runnext();
 signal_skip_to_the_end_1:
 	} else {
 		sem->count++;
 		MR_UNLOCK(&(sem->lock), ""semaphore__signal"");
 			/* yield() */
-		MR_save_context(MR_ENGINE(this_context));
-		MR_ENGINE(this_context)->resume = &&signal_skip_to_the_end_2;
-		MR_schedule(MR_ENGINE(this_context));
+		MR_save_context(MR_ENGINE(MR_eng_this_context));
+		MR_ENGINE(MR_eng_this_context)->resume =
+			&&signal_skip_to_the_end_2;
+		MR_schedule(MR_ENGINE(MR_eng_this_context));
 		MR_runnext();
 signal_skip_to_the_end_2:
 	}
@@ -199,10 +201,11 @@
 		sem->count--;
 		MR_UNLOCK(&(sem->lock), ""semaphore__wait"");
 	} else {
-		MR_save_context(MR_ENGINE(this_context));
-		MR_ENGINE(this_context)->resume = &&wait_skip_to_the_end;
-		MR_ENGINE(this_context)->next = sem->suspended;
-		sem->suspended = MR_ENGINE(this_context);
+		MR_save_context(MR_ENGINE(MR_eng_this_context));
+		MR_ENGINE(MR_eng_this_context)->resume =
+			&&wait_skip_to_the_end;
+		MR_ENGINE(MR_eng_this_context)->next = sem->suspended;
+		sem->suspended = MR_ENGINE(MR_eng_this_context);
 		MR_UNLOCK(&(sem->lock), ""semaphore__wait"");
 		MR_runnext();
 wait_skip_to_the_end:
--------------------------------------------------------------------------
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