MCPcopy Create free account
hub / github.com/eth-easl/dirigent / NewProcessMonitor

Function NewProcessMonitor

internal/worker_node/managers/process_monitor.go:45–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45func NewProcessMonitor() *ProcessMonitor {
46 var cn garlic.CnConn
47 var err error
48
49 for i := 1; i <= PCNStartupTries; i++ {
50 cn, err = garlic.DialPCNWithEvents([]garlic.EventType{garlic.ProcEventExit})
51 if err != nil {
52 logrus.Errorf("Failed do start process monitor (attempt %d): (error: %s)", i, err.Error())
53 continue
54 }
55
56 break
57 }
58
59 if err != nil {
60 // kill worker node daemon if process monitor doesn't start
61 logrus.Fatalf("Failed do start process monitor. Terminating worker daemon.")
62 }
63
64 pm := &ProcessMonitor{
65 PCN: cn,
66 NotifyChannels: make(map[uint32]chan uint32),
67 RWMutex: sync.RWMutex{},
68 }
69
70 go pm.internalEventHandler()
71
72 return pm
73}
74
75func (pm *ProcessMonitor) AddChannel(PID uint32, notifyChannel chan uint32) {
76 pm.Lock()

Callers 3

NewFirecrackerRuntimeFunction · 0.92
NewContainerdRuntimeFunction · 0.92

Calls 1

internalEventHandlerMethod · 0.95

Tested by 1