fix pcqueuepop race condition in pigback in multisend
authorYanhua Sun <yanhuas@jyc1.(none)>
Fri, 9 Mar 2012 06:18:27 +0000 (00:18 -0600)
committerYanhua Sun <yanhuas@jyc1.(none)>
Fri, 9 Mar 2012 06:18:27 +0000 (00:18 -0600)
src/arch/gemini_gni/machine.c

index 3ce60e2d03cb6b5ef4c2bc38a191ec557cae49aa..620c72b4aa8ff21bfe4631f00c2fd0749324c839 100644 (file)
 #endif
 
 #if CMK_SMP
-#if LARGEPAGE
-#define MULTI_THREAD_SEND 1
-#else
+//#define MULTI_THREAD_SEND 1
 #define COMM_THREAD_SEND 1
 #endif
-#endif
 
 #if CMK_SMP
 #define PIGGYBACK_ACK              0
@@ -1134,7 +1131,9 @@ static void * piggyback_ack(int destNode, int msgsize, int *count)
     buf[0] = piggycount-1;
 //printf("[%d] piggyback_ack: %d\n", myrank, piggycount);
     for (i=0; i<piggycount-1; i++) {
+        CMI_PCQUEUEPOP_LOCK(smsg_ack_queue.smsg_msglist_index[destNode].sendSmsgBuf)
         MSG_LIST *ptr = (MSG_LIST*)PCQueuePop(smsg_ack_queue.smsg_msglist_index[destNode].sendSmsgBuf);
+        CMI_PCQUEUEPOP_UNLOCK(smsg_ack_queue.smsg_msglist_index[destNode].sendSmsgBuf)
         CmiAssert(ptr != NULL);
         ACK_MSG *msg = ptr->msg;
         buf[i+1] = msg->source_addr;