- vector<Node*> children = node->children();
-
- //Iterate over the children for this node
- for(vector<Node*>::iterator child = children.begin(); child != children.end(); ++child){
- //Satisfy the preconditions the current node had as effect.
- if ((*child)->satisfyConditions(node->effects())){
- //If all preconditions were satisified we can create a new thread
- //and execute this child.
- ++executions;
- pthread_attr_t tattr;
- pthread_t tid;
- pthread_attr_init(&tattr);
- pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM);
- //Create a struct object for the thread and add the
- //needed members to it.
- ExecutionStuff* es = new ExecutionStuff;
- es->nodes = &_nodes;
- es->list = &_list;
- es->node = *child;
- es->execQueue = &_executedNodes;
- pthread_create(&tid, &tattr, executeNode, es);
- }
- }