]> rtime.felk.cvut.cz Git - orte.git/blob - orte/liborte/ORTEThreadUtils.c
Added prerelease of ORTE-0.2 (Real Time Publisher Subscriber communication protocol...
[orte.git] / orte / liborte / ORTEThreadUtils.c
1 /*
2  *  $Id: ORTEThreadUtils.c,v 0.0.0.1    2003/08/21 
3  *
4  *  DEBUG:  section 25                   Thread utility
5  *  AUTHOR: Petr Smolik                 petr.smolik@wo.cz
6  *
7  *  ORTE - OCERA Real-Time Ethernet     http://www.ocera.org/
8  *  --------------------------------------------------------------------
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *  
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *  
20  */ 
21
22 #include "orte.h"
23
24 /*****************************************************************************/
25 void
26 ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,u_int16_t port) {
27   struct sockaddr_in    des;
28   int                   i;
29
30   des.sin_family = AF_INET;
31   des.sin_port = htons(port);             //to receiving port
32   if (d->domainProp.IFCount) {
33     for(i=0;i<d->domainProp.IFCount;i++) {
34       des.sin_addr.s_addr=htonl(d->domainProp.IFProp[i].ipAddress);
35       sock_sendto(sock,&i,1,&des,sizeof(des));
36       debug(25,2) ("Sent wake up signal to: %s.%d\n",
37                     IPAddressToString(ntohl(des.sin_addr.s_addr)),
38       port);
39     }
40   } else {
41     des.sin_addr.s_addr = inet_addr("127.0.0.1"); //local IPAddress
42     sock_sendto(sock,NULL,0,&des,sizeof(des));
43     debug(25,2) ("Sent wake up signal to: %s.%d\n",
44                   IPAddressToString(ntohl(des.sin_addr.s_addr)),
45                   port);
46   }
47 }
48
49 /*****************************************************************************/
50 void
51 ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry) {
52   if (objectEntry->htimNeedWakeUp)
53     pthread_mutex_unlock(&objectEntry->htimSendMutex);
54 }
55
56
57