From aa960b94201a22b9d5c6b7feb6868c83bdea47fe Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Mon, 24 Jul 2023 18:39:33 -0600 Subject: [PATCH] Added started signal to ThreadStart --- thread.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/thread.go b/thread.go index 06015bd..b342d24 100644 --- a/thread.go +++ b/thread.go @@ -578,13 +578,19 @@ func ThreadRestore(ctx * Context, node ThreadNode, start bool) error { func ThreadStart(ctx * Context, node ThreadNode) (string, error) { thread := node.ThreadHandle() context := NewWriteContext(ctx) - return "wait", UpdateStates(context, thread, NewLockInfo(thread, []string{"state"}), func(context *StateContext) error { + err := UpdateStates(context, thread, NewLockInfo(thread, []string{"state"}), func(context *StateContext) error { err := LockLockables(context, map[NodeID]LockableNode{thread.ID(): thread}, thread) if err != nil { return err } return thread.SetState("started") }) + if err != nil { + return "", err + } + + context = NewReadContext(ctx) + return "wait", Signal(context, thread, thread, NewStatusSignal("started", thread.ID())) } func ThreadWait(ctx * Context, node ThreadNode) (string, error) {