IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2008, 12:52:06 PM (18 years ago)
Author:
eugene
Message:

use virtual stacks for host and job queries by user thread

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pcontrol/HostOps.c

    r17476 r18098  
    11# include "pcontrol.h"
     2
     3Stack *HostPool_AllHosts;  // virtual pool for user status queries
    24
    35Stack *HostPool_Idle; // these hosts are waiting for something to do
     
    911
    1012void InitHostStacks () {
     13  HostPool_AllHosts = InitStack ();
     14
    1115  HostPool_Idle = InitStack ();
    1216  HostPool_Busy = InitStack ();
     
    2630
    2731void FreeHostStacks () {
     32  // AllHosts is a virtual stack : all hosts are references
     33  FreeStack (HostPool_AllHosts);
     34
    2835  FreeHostStack (HostPool_Idle);
    2936  FreeHostStack (HostPool_Busy);
     
    3643char *GetHostStackName (int StackID) {
    3744  switch (StackID) {
     45    case PCONTROL_HOST_ALLHOSTS: return ("ALLHOSTS");
    3846    case PCONTROL_HOST_IDLE: return ("IDLE");
    3947    case PCONTROL_HOST_DOWN: return ("DOWN");
     
    5058Stack *GetHostStack (int StackID) {
    5159  switch (StackID) {
     60    case PCONTROL_HOST_ALLHOSTS: return (HostPool_AllHosts);
    5261    case PCONTROL_HOST_IDLE: return (HostPool_Idle);
    5362    case PCONTROL_HOST_DOWN: return (HostPool_Down);
     
    6372
    6473Stack *GetHostStackByName (char *name) {
     74  if (!strcasecmp (name, "all")) return (HostPool_AllHosts);
    6575  if (!strcasecmp (name, "idle")) return (HostPool_Idle);
    6676  if (!strcasecmp (name, "down")) return (HostPool_Down);
     
    202212  host[0].markoff  = FALSE;
    203213  host[0].job      = NULL;
     214
     215  PutHost (host, PCONTROL_HOST_ALLHOSTS, STACK_BOTTOM);
    204216  PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
    205217  return (host[0].HostID);
     
    207219
    208220void DelHost (Host *host) {
     221
     222  Host *copy;
     223
     224  copy = PullStackByID (HostPool_AllHosts, host[0].HostID);
     225  ASSERT (copy == host, "programming error: ALLHOSTS entry does not match");
     226
    209227  FreeIOBuffer (&host[0].comms_buffer);
    210228  FREE (host[0].hostname);
Note: See TracChangeset for help on using the changeset viewer.