File: workerstate.cpp

package info (click to toggle)
dmtcp 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,496 kB
  • sloc: cpp: 33,592; ansic: 28,099; sh: 6,735; makefile: 1,950; perl: 1,690; python: 1,241; asm: 138; java: 13
file content (49 lines) | stat: -rw-r--r-- 1,440 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "dmtcpalloc.h"
#include "workerstate.h"

#include "jassert.h"

namespace dmtcp
{
namespace WorkerState
{

static eWorkerState workerState = WorkerState::UNKNOWN;

void setCurrentState(const eWorkerState& value)
{
  workerState = value;
}


eWorkerState currentState()
{
  return workerState;
}


ostream& operator << (ostream& o, const eWorkerState& s)
{
  o << "WorkerState::";
  switch (s) {
    case WorkerState::UNKNOWN:      o << "UNKNOWN"; break;
    case WorkerState::RUNNING:      o << "RUNNING"; break;
    case WorkerState::SUSPENDED:    o << "SUSPENDED"; break;
    case WorkerState::FD_LEADER_ELECTION:  o << "FD_LEADER_ELECTION"; break;
    case WorkerState::PRE_CKPT_NAME_SERVICE_DATA_REGISTER:  o << "PRE_CKPT_NAME_SERVICE_DATA_REGISTER"; break;
    case WorkerState::PRE_CKPT_NAME_SERVICE_DATA_QUERY:  o << "PRE_CKPT_NAME_SERVICE_DATA_QUERY"; break;
    case WorkerState::NAME_SERVICE_DATA_REGISTERED: o << "NAME_SERVICE_DATA_REGISTERED"; break;
    case WorkerState::DONE_QUERYING: o << "DONE_QUERYING"; break;
    case WorkerState::DRAINED:      o << "DRAINED"; break;
    case WorkerState::RESTARTING:   o << "RESTARTING"; break;
    case WorkerState::CHECKPOINTED: o << "CHECKPOINTED"; break;
    case WorkerState::REFILLED:     o << "REFILLED"; break;
    default:
      JASSERT(false) (workerState) .Text("Invalid WorkerState");
      break;
  }
  return o;
}

} // namespace WorkerState
} // namespace dmtcp