[m-rev.] diff: fix concurrency examples on MinGW

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Dec 15 03:46:37 AEDT 2010


Branches: main

Fix a problem with two of the concurrency examples on MinGW.

samples/concurrency/dining_philosophers/philo2.m:
samples/concurrency/dining_philosophers/philo3.m:
 	Use Sleep() whenever the Win32 API is available instead
 	of only when MSVC is being used.

Julien.

Index: samples/concurrency/dining_philosophers/philo2.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/concurrency/dining_philosophers/philo2.m,v
retrieving revision 1.2
diff -u -r1.2 philo2.m
--- samples/concurrency/dining_philosophers/philo2.m	8 Nov 2010 08:24:05 -0000	1.2
+++ samples/concurrency/dining_philosophers/philo2.m	14 Dec 2010 16:42:35 -0000
@@ -126,7 +126,7 @@
      rand_sleep(Int::in, _IO0::di, _IO::uo),
      [promise_pure, thread_safe, will_not_call_mercury],
  "
-#ifdef _MSC_VER
+#if defined(MR_WIN32)
      Sleep(1000 * (rand() % Int));
  #else
      sleep((rand() % Int));
Index: samples/concurrency/dining_philosophers/philo3.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/samples/concurrency/dining_philosophers/philo3.m,v
retrieving revision 1.2
diff -u -r1.2 philo3.m
--- samples/concurrency/dining_philosophers/philo3.m	8 Nov 2010 08:24:05 -0000	1.2
+++ samples/concurrency/dining_philosophers/philo3.m	14 Dec 2010 16:42:35 -0000
@@ -97,15 +97,14 @@

  :- pred rand_sleep(int::in, io::di, io::uo) is det.
  :- pragma foreign_proc("C",
-    rand_sleep(Int::in, IO0::di, IO::uo),
+    rand_sleep(Int::in, _IO0::di, _IO::uo),
  	[promise_pure, thread_safe, will_not_call_mercury],
  "
-#ifdef _MSC_VER
+#if defined(MR_WIN32)
  	Sleep(1000 * (rand() % Int));
  #else
  	sleep((rand() % Int));
  #endif
-	IO =  IO0;
  ").

  :- pragma foreign_proc("C#",

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list