diff --git a/MAC/Navigator/panels/nav_fw/navigator.pnl b/MAC/Navigator/panels/nav_fw/navigator.pnl index 0ac2b3c8d548eec05a98588dc48d7204cd328528..64a64e3301dd7fe85522949bf192fce35a0964a9 100644 --- a/MAC/Navigator/panels/nav_fw/navigator.pnl +++ b/MAC/Navigator/panels/nav_fw/navigator.pnl @@ -4,8 +4,8 @@ LANG:1 15 LOFAR Navigator PANEL,417 201 1272 960 N "_3DFace" 0 "main() { + gcfStartFollowDistSystems(); navConfigCheckResourceRoots(); - navPMLinitialize(); Navigator_HandleEventInitialize(); navConfigInitPathNames(); } diff --git a/MAC/Navigator/scripts/libs/nav_fw/gcf-common.ctl b/MAC/Navigator/scripts/libs/nav_fw/gcf-common.ctl index 6a881016d658c7933c9e752e4404be8cd4f29a2d..4b4914aaf2f7a935eab293f84736920b7e19f049 100644 --- a/MAC/Navigator/scripts/libs/nav_fw/gcf-common.ctl +++ b/MAC/Navigator/scripts/libs/nav_fw/gcf-common.ctl @@ -7,28 +7,56 @@ // Output: TRUE, if accessable and existing, // FALSE, if not accessable and/or not existing /////////////////////////////////////////////////////////////////////////// + +global dyn_int g_distributedSystems; +global int g_distSysVarSem = 0; + +void gcfStartFollowDistSystems() +{ + g_distSysVarSem = 0; + dpConnect("followDistributedSystems", "_DistManager.State.SystemNums"); +} + +void followDistributedSystems(string dp, dyn_int value) +{ + while (g_distSysVarSem > 0) // wait until the "semaphore" is freed by the dpAccessable method + ; + g_distributedSystems = value; +} + bool dpAccessable(string dpName) { - string dpSystemName = strrtrim(dpSubStr(dpName,DPSUB_SYS),":"); - if(getSystemName()==(dpSystemName+":")) - { - return dpExists(dpName); - } - else if (getSystemName()!=(dpSystemName+":")) + if (dpExists(dpName)) { - dyn_int distributedSystems; - dpGet("_DistManager.State.SystemNums", distributedSystems); - //Check if dpSystemName is in the distributedSystems list - if (dynlen(distributedSystems)>0) + string dpSystemName = strrtrim(dpSubStr(dpName, DPSUB_SYS), ":"); + if (getSystemName() == (dpSystemName + ":")) { - for(int i=1; i<=dynlen(distributedSystems); i++) + return TRUE; + } + else + { + g_distSysVarSem++; // set "semaphore" + // check if the dist. system with the systemname from the dpName is reachable + if (dynlen(g_distributedSystems) > 0) { - if(getSystemName(distributedSystems[i])==(dpSystemName+":")) //if the system is reacheable + // Check whether the first part of the dpName is a valid system name + // and the name of a reachable dist. system + dyn_string splitedDPName = strsplit(dpName, ':'); + for (int i = 1; i <= dynlen(g_distributedSystems); i++) { - return dpExists(dpName); + if (getSystemName(g_distributedSystems[i]) == (splitedDPName[1] + ":")) + { + g_distSysVarSem--; // release "semaphore" + return TRUE; + } } } + g_distSysVarSem--; // release "semaphore" + return FALSE; } + } + else + { return FALSE; } }