]> rtime.felk.cvut.cz Git - orte.git/blobdiff - orte/liborte/ORTEThreadUtils.c
New ORTE version 0.3.0 committed
[orte.git] / orte / liborte / ORTEThreadUtils.c
index 218d6c693e3fce63987d8d4a0d4a137300f97487..235fa502b9e755c13d186eaa89d017051a3e34c4 100644 (file)
  *  
  */ 
 
-#include "orte.h"
+#include "orte_all.h"
 
 /*****************************************************************************/
 void
-ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,u_int16_t port) {
+ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,uint16_t port) {
   struct sockaddr_in    des;
   char                  sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
   int                   i;
@@ -40,7 +40,7 @@ ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,u_int16_t port) {
     }
   } else {
     des.sin_addr.s_addr = inet_addr("127.0.0.1"); //local IPAddress
-    sock_sendto(sock,NULL,0,&des,sizeof(des));
+    sock_sendto(sock,&i,1,&des,sizeof(des));
     debug(25,2) ("Sent wake up signal to: %s.%d\n",
                   IPAddressToString(ntohl(des.sin_addr.s_addr),sIPAddress),
                   port);
@@ -50,8 +50,16 @@ ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,u_int16_t port) {
 /*****************************************************************************/
 void
 ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry) {
-  if (objectEntry->htimNeedWakeUp)
+  debug(25,10) ("WakeUpSendingThread : start\n");
+  if (objectEntry->htimNeedWakeUp) {
+    pthread_mutex_lock(&objectEntry->htimSendMutex);
+    if (objectEntry->htimSendCondValue==0) {
+      debug(25,8) ("WakeUpSendingThread : send wakeup signal\n");
+      pthread_cond_signal(&objectEntry->htimSendCond);
+      objectEntry->htimSendCondValue=1;
+    }
     pthread_mutex_unlock(&objectEntry->htimSendMutex);
+  }
 }