beforeScriptExecution returns the name of the script or an empty string on shutdown
()
| 38 | |
| 39 | // beforeScriptExecution returns the name of the script or an empty string on shutdown |
| 40 | func (handler *regularThread) beforeScriptExecution() string { |
| 41 | switch handler.state.Get() { |
| 42 | case state.TransitionRequested: |
| 43 | detachRegularThread(handler.thread) |
| 44 | return handler.thread.transitionToNewHandler() |
| 45 | |
| 46 | case state.TransitionComplete: |
| 47 | handler.thread.updateContext(false) |
| 48 | handler.state.Set(state.Ready) |
| 49 | |
| 50 | return handler.waitForRequest() |
| 51 | |
| 52 | case state.Ready: |
| 53 | return handler.waitForRequest() |
| 54 | |
| 55 | case state.RebootReady: |
| 56 | handler.requestCount = 0 |
| 57 | handler.state.Set(state.Ready) |
| 58 | return handler.waitForRequest() |
| 59 | |
| 60 | case state.ShuttingDown: |
| 61 | detachRegularThread(handler.thread) |
| 62 | // signal to stop |
| 63 | return "" |
| 64 | } |
| 65 | |
| 66 | panic("unexpected state: " + handler.state.Name()) |
| 67 | } |
| 68 | |
| 69 | func (handler *regularThread) afterScriptExecution(_ int) { |
| 70 | handler.thread.requestCount.Add(1) |
no test coverage detected