FACT++  1.0
int startMonitorThread ( )

Definition at line 1878 of file feeserver.c.

References createLogMessage(), monitorIntValues(), and monitorValues().

Referenced by start().

1878  {
1879  int status = -1;
1880  pthread_attr_t attr;
1881 
1882  // when item lists are empty, no monitor threads are needed
1883  if ((nodesAmount == 0) && (intNodesAmount == 0)) {
1884  createLogMessage(MSG_INFO,
1885  "No Items (float and int) for monitoring are available.", 0);
1886  return FEE_OK;
1887  }
1888 
1889  // init thread attribut and set it
1890  status = pthread_attr_init(&attr);
1891  if (status != 0) {
1892 # ifdef __DEBUG
1893  printf("Init attribute error [mon]: %d\n", status);
1894  fflush(stdout);
1895 # endif
1896  return FEE_MONITORING_FAILED;
1897  }
1898  status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
1899  if (status != 0) {
1900 # ifdef __DEBUG
1901  printf("Set attribute error [mon]: %d\n", status);
1902  fflush(stdout);
1903 # endif
1904  return FEE_MONITORING_FAILED;
1905  }
1906 
1907  // start the monitor thread for float values
1908  if (nodesAmount > 0) {
1909  status = pthread_create(&thread_mon, &attr, (void*)&monitorValues, 0);
1910  if (status != 0) {
1911 # ifdef __DEBUG
1912  printf("Create thread error [mon - float]: %d\n", status);
1913  fflush(stdout);
1914 # endif
1915  return FEE_MONITORING_FAILED;
1916  }
1917  }
1918 
1919  //start the monitor thread for int values --> NEW v.0.8.1
1920  if (intNodesAmount > 0) {
1921  status = pthread_create(&thread_mon_int, &attr, (void*)&monitorIntValues, 0);
1922  if (status != 0) {
1923 # ifdef __DEBUG
1924  printf("Create thread error [mon - int]: %d\n", status);
1925  fflush(stdout);
1926 # endif
1927  return FEE_MONITORING_FAILED;
1928  }
1929  }
1930 
1931  // cleanup attribut
1932  status = pthread_attr_destroy(&attr);
1933  if (status != 0) {
1934 # ifdef __DEBUG
1935  printf("Destroy attribute error [mon]: %d\n", status);
1936  fflush(stdout);
1937 # endif
1938  // no error return value necessary !
1939  }
1940  return FEE_OK;
1941 }
static pthread_t thread_mon_int
Definition: feeserver.c:299
static unsigned int intNodesAmount
Definition: feeserver.c:293
void createLogMessage(unsigned int type, char *description, char *origin)
Definition: feeserver.c:1530
static pthread_t thread_mon
Definition: feeserver.c:223
void monitorValues()
Definition: feeserver.c:1944
static unsigned int nodesAmount
Definition: feeserver.c:139
void monitorIntValues()
Definition: feeserver.c:3540

+ Here is the call graph for this function:

+ Here is the caller graph for this function: