|
|
@ -88,14 +88,15 @@ func LinkThreads(context *StateContext, princ Node, thread_node ThreadNode, info
|
|
|
|
}
|
|
|
|
}
|
|
|
|
thread := thread_node.ThreadHandle()
|
|
|
|
thread := thread_node.ThreadHandle()
|
|
|
|
child := info.Child.ThreadHandle()
|
|
|
|
child := info.Child.ThreadHandle()
|
|
|
|
|
|
|
|
child_node := info.Child
|
|
|
|
|
|
|
|
|
|
|
|
if thread.ID() == child.ID() {
|
|
|
|
if thread.ID() == child.ID() {
|
|
|
|
return fmt.Errorf("Will not link %s as a child of itself", thread.ID())
|
|
|
|
return fmt.Errorf("Will not link %s as a child of itself", thread.ID())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return UpdateStates(context, princ, LockMap{
|
|
|
|
return UpdateStates(context, princ, LockMap{
|
|
|
|
child.ID(): LockInfo{Node: child, Resources: []string{"parent"}},
|
|
|
|
child.ID(): LockInfo{Node: child_node, Resources: []string{"parent"}},
|
|
|
|
thread.ID(): LockInfo{Node: thread, Resources: []string{"children"}},
|
|
|
|
thread.ID(): LockInfo{Node: thread_node, Resources: []string{"children"}},
|
|
|
|
}, func(context *StateContext) error {
|
|
|
|
}, func(context *StateContext) error {
|
|
|
|
if child.Parent != nil {
|
|
|
|
if child.Parent != nil {
|
|
|
|
return fmt.Errorf("EVENT_LINK_ERR: %s already has a parent, cannot link as child", child.ID())
|
|
|
|
return fmt.Errorf("EVENT_LINK_ERR: %s already has a parent, cannot link as child", child.ID())
|
|
|
|