From 29cc71da99fc52345901adc795b4e158798ac192 Mon Sep 17 00:00:00 2001 From: Dongryeol Lee Date: Mon, 11 Oct 2010 18:43:42 +0000 Subject: [PATCH] It turns out my MPI implementation supports only single-thread, so I need a mutex around MPI_IProbe. --- .../contrib/dongryel/thesis_research/core/table/mailbox.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fastlib/trunk/contrib/dongryel/thesis_research/core/table/mailbox.h b/fastlib/trunk/contrib/dongryel/thesis_research/core/table/mailbox.h index 6f2cfeb2f0..0a04aa5c7e 100644 --- a/fastlib/trunk/contrib/dongryel/thesis_research/core/table/mailbox.h +++ b/fastlib/trunk/contrib/dongryel/thesis_research/core/table/mailbox.h @@ -12,6 +12,10 @@ namespace core { namespace table { +/** @brief The global variable for each MPI call. + */ +boost::mutex mpi_mutex; + class Table; class PointInbox { @@ -92,6 +96,7 @@ class PointInbox { bool has_outstanding_point_messages() { int flag; MPI_Status status; + boost::unique_lock lock_in(core::table::mpi_mutex); MPI_Iprobe( MPI_ANY_SOURCE, core::table::DistributedTableMessage::RECEIVE_POINT, @@ -102,6 +107,7 @@ class PointInbox { bool termination_signal_arrived() { int flag; MPI_Status status; + boost::unique_lock lock_in(core::table::mpi_mutex); MPI_Iprobe( MPI_ANY_SOURCE, core::table::DistributedTableMessage::TERMINATE_POINT_INBOX, @@ -228,6 +234,7 @@ class PointRequestMessageBox { bool termination_signal_arrived() { int flag; MPI_Status status; + boost::unique_lock lock_in(core::table::mpi_mutex); MPI_Iprobe( MPI_ANY_SOURCE, core::table::DistributedTableMessage::TERMINATE_POINT_REQUEST_MESSAGE_BOX, @@ -258,6 +265,7 @@ class PointRequestMessageBox { bool has_outstanding_point_request_messages() { int flag; MPI_Status status; + boost::unique_lock lock_in(core::table::mpi_mutex); MPI_Iprobe( MPI_ANY_SOURCE, core::table::DistributedTableMessage::REQUEST_POINT,