[m-rev.] diff: Fix undefined reference to MR_thread_pinning.

Peter Wang novalazy at gmail.com
Wed May 23 18:04:22 AEST 2018


This was possible when building against an old glibc where
MR_HAVE_SCHED_SETAFFINITY does not imply MR_HAVE_THREAD_PINNING.

runtime/mercury_context.h:
runtime/mercury_wrapper.c:
    Declare MR_thread_pinning and only use it when actually building
    with thread pinning support.
---
 runtime/mercury_context.h | 2 +-
 runtime/mercury_wrapper.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/runtime/mercury_context.h b/runtime/mercury_context.h
index 3e0e8349f..45a97d8d6 100644
--- a/runtime/mercury_context.h
+++ b/runtime/mercury_context.h
@@ -357,21 +357,21 @@ struct MR_Context_Struct {
 };
 
 // The runqueue is a linked list of contexts that are runnable.
 
 extern      MR_Context  *MR_runqueue_head;
 extern      MR_Context  *MR_runqueue_tail;
 #ifdef  MR_THREAD_SAFE
   extern    MercuryLock MR_runqueue_lock;
   extern    MercuryCond MR_runqueue_cond;
 #endif
-#ifdef  MR_LL_PARALLEL_CONJ
+#if defined(MR_LL_PARALLEL_CONJ) && defined(MR_HAVE_THREAD_PINNING)
   extern    MR_bool     MR_thread_pinning;
 #endif
 
 #ifdef MR_PROFILE_PARALLEL_EXECUTION_SUPPORT
 extern MR_bool      MR_profile_parallel_execution;
 
 // XXX: This is currently unused, we plan to use it in the future. -pbone
 extern MR_Stats     MR_profile_parallel_executed_local_sparks;
 #endif
 
diff --git a/runtime/mercury_wrapper.c b/runtime/mercury_wrapper.c
index c4ba5ff45..ccd8951e9 100644
--- a/runtime/mercury_wrapper.c
+++ b/runtime/mercury_wrapper.c
@@ -1807,21 +1807,21 @@ MR_process_options(int argc, char **argv)
                 {
                     MR_usage();
                 }
                 if (MR_granularity_wsdeque_length_factor < 1) {
                     MR_usage();
                 }
 #endif
                 break;
 
             case MR_THREAD_PINNING:
-#if defined(MR_LL_PARALLEL_CONJ) && defined(MR_HAVE_SCHED_SETAFFINITY)
+#if defined(MR_LL_PARALLEL_CONJ) && defined(MR_HAVE_THREAD_PINNING)
                 MR_thread_pinning = MR_TRUE;
 #endif
                 break;
 
             case MR_PROFILE_PARALLEL_EXECUTION:
 #ifdef MR_PROFILE_PARALLEL_EXECUTION_SUPPORT
                 MR_profile_parallel_execution = MR_TRUE;
 #endif
                 break;
 
-- 
2.17.0



More information about the reviews mailing list