2 * $Id: ORTEThreadUtils.c,v 0.0.0.1 2003/08/21
4 * DEBUG: section 25 Thread utility
5 * AUTHOR: Petr Smolik petr.smolik@wo.cz
7 * ORTE - OCERA Real-Time Ethernet http://www.ocera.org/
8 * --------------------------------------------------------------------
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.
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.
24 /*****************************************************************************/
26 ORTEDomainWakeUpReceivingThread(ORTEDomain *d,sock_t *sock,u_int16_t port) {
27 struct sockaddr_in des;
28 char sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
31 des.sin_family = AF_INET;
32 des.sin_port = htons(port); //to receiving port
33 if (d->domainProp.IFCount) {
34 for(i=0;i<d->domainProp.IFCount;i++) {
35 des.sin_addr.s_addr=htonl(d->domainProp.IFProp[i].ipAddress);
36 sock_sendto(sock,&i,1,&des,sizeof(des));
37 debug(25,2) ("Sent wake up signal to: %s.%d\n",
38 IPAddressToString(ntohl(des.sin_addr.s_addr),sIPAddress),
42 des.sin_addr.s_addr = inet_addr("127.0.0.1"); //local IPAddress
43 sock_sendto(sock,NULL,0,&des,sizeof(des));
44 debug(25,2) ("Sent wake up signal to: %s.%d\n",
45 IPAddressToString(ntohl(des.sin_addr.s_addr),sIPAddress),
50 /*****************************************************************************/
52 ORTEDomainWakeUpSendingThread(ObjectEntry *objectEntry) {
53 debug(25,10) ("WakeUpSendingThread : start\n");
54 if (objectEntry->htimNeedWakeUp) {
56 sem_getvalue(&objectEntry->htimSendSem,&value);
57 debug(25,8) ("WakeUpSendingThread : value:%d\n",value);
59 sem_post(&objectEntry->htimSendSem);