control show of character,global callbacks, re-add replies during internal runs to self-stop

This commit is contained in:
Ettore Di Giacinto
2024-04-05 01:20:20 +02:00
parent 744af19025
commit 652cef288d
9 changed files with 165 additions and 60 deletions

View File

@@ -20,9 +20,10 @@ type Job struct {
type JobResult struct {
sync.Mutex
// The result of a job
State []ActionState
Error error
ready chan bool
State []ActionState
Response string
Error error
ready chan bool
}
type JobOption func(*Job)
@@ -104,6 +105,14 @@ func (j *JobResult) Finish(e error) {
close(j.ready)
}
// SetResult sets the result of a job
func (j *JobResult) SetResponse(response string) {
j.Lock()
defer j.Unlock()
j.Response = response
}
// WaitResult waits for the result of a job
func (j *JobResult) WaitResult() *JobResult {
<-j.ready