[m-rev.] diff: workaround linking problems in non .par hl* grades
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri Aug 31 19:00:31 AEST 2007
I'm intending to take a look at stm_builtin soon. I'll fix
this properly then.
Estimated hours taken: 0.1
Branches: main
Workaround a linking problem with the hl* grades.
library/stm_builtin.m:
Add a dummy definition for ML_ThreadId in grades
where MR_THREAD_SAFE is not defined.
Do not call pthread functions when MR_THREAD_SAFE
is not defined.
Julien.
Index: stm_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/stm_builtin.m,v
retrieving revision 1.5
diff -u -r1.5 stm_builtin.m
--- stm_builtin.m 23 Aug 2007 05:38:35 -0000 1.5
+++ stm_builtin.m 31 Aug 2007 08:55:59 -0000
@@ -135,15 +135,24 @@
:- import_module exception.
-
:- pragma foreign_decl("C", "
+
#if defined(MR_HIGHLEVEL_CODE)
- #include <pthread.h>
- typedef pthread_t ML_ThreadId;
-#else
+ #if defined(MR_THREAD_SAFE)
+ #include <pthread.h>
+
+ typedef pthread_t ML_ThreadId;
+ #else
+ typedef MR_Integer ML_ThreadId;
+
+ #endif /* !MR_THREAD_SAFE */
+
+#else /* !MR_HIGHLEVEL_CODE */
+
typedef MR_Context *ML_ThreadId;
-#endif
+
+#endif /* !MR_HIGHLEVEL_CODE */
typedef struct ML_Stm_Wait_List_Struct {
ML_ThreadId thread;
@@ -382,11 +391,15 @@
STM = MR_GC_NEW(ML_Stm_TLog);
STM->entrylist = NULL;
-#if defined(MR_HIGHLEVEL_CODE)
- STM->thread = pthread_self();
-#else
- STM->thread = NULL; /* current context */
-#endif
+ #if defined(MR_HIGHLEVEL_CODE)
+ #if defined(MR_THREAD_SAFE)
+ STM->thread = pthread_self();
+ #else
+ STM->thread = 0;
+ #endif
+ #else
+ STM->thread = NULL; /* current context */
+ #endif
").
:- pragma foreign_proc("C", stm_drop_state(X::di),
--------------------------------------------------------------------------
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