insertdeallocatetask
The insertdeallocatetask command de-allocates a specific task executer, referenced by its key. The first parameter references the coordinated task sequence. The second parameter is the allocation key for the resource you want to de-allocate. The third parameter is optional, and specifies whether the task is blocking. By default (0), the task is blocking. If 1 is passed in, then the task will not be blocking.
The above code creates a coordinated task sequence that organizes the two task sequences, as shown in the diagram below.
insertdeallocatetask命令取消分配由其键引用的特定任务执行器。 第一个参数引用协调的任务序列。 第二个参数是要取消分配的资源的分配键。 第三个参数是可选的,指定任务是否阻塞。 默认情况下(0),任务阻塞。 如果传入1,则任务不会阻塞。
Coordinated Task Sequence实例
treenode ts = createcoordinatedtasksequence(operatorteam);
int opkey = insertallocatetask(ts, operatorteam, 0, 0);
int forkliftkey = insertallocatetask(ts, forkliftteam, 0,0);
int traveltask = insertproxytask(ts, opkey, TASKTYPE_TRAVEL, forkliftkey, NULL);
insertsynctask(ts, traveltask);
insertproxytask(ts, forkliftkey, TASKTYPE_MOVEOBJECT, opkey, forkliftkey);
insertproxytask(ts, forkliftkey, TASKTYPE_TRAVEL, loadstation, NULL);
insertproxytask(ts, forkliftkey, TASKTYPE_LOAD, item, loadstation);
insertproxytask(ts, forkliftkey, TASKTYPE_TRAVEL, unloadstation, NULL);
insertproxytask(ts, forkliftkey, TASKTYPE_UNLOAD, item, unloadstation);
insertproxytask(ts, forkliftkey, TASKTYPE_TRAVEL, forkliftteam, NULL);
insertproxytask(ts, forkliftkey, TASKTYPE_MOVEOBJECT, opkey, model());
insertdeallocatetask(ts, forkliftkey);
insertdeallocatetask(ts, opkey);
dispatchcoordinatedtasksequence(ts); |