Added started signal to ThreadStart

graph-rework-2
noah metz 2023-07-24 18:39:33 -06:00
parent cf35d8a86d
commit aa960b9420
1 changed files with 7 additions and 1 deletions

@ -578,13 +578,19 @@ func ThreadRestore(ctx * Context, node ThreadNode, start bool) error {
func ThreadStart(ctx * Context, node ThreadNode) (string, error) { func ThreadStart(ctx * Context, node ThreadNode) (string, error) {
thread := node.ThreadHandle() thread := node.ThreadHandle()
context := NewWriteContext(ctx) 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) err := LockLockables(context, map[NodeID]LockableNode{thread.ID(): thread}, thread)
if err != nil { if err != nil {
return err return err
} }
return thread.SetState("started") 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) { func ThreadWait(ctx * Context, node ThreadNode) (string, error) {