+
+/*
+ Evaluates Rule C & D of Dijkstra-Scholten. Caller must already hold state_mutex!
+*/
+static void try_resolve_tree(int my_id)
+{
+ if (state == PASSIVE_STATE && deficit == 0)
+ {
+ if (is_initiator) {
+ // Root is passive and deficit is 0 -> Global Termination!
+ return;
+ }
+
+ if (parent != -1)
+ {
+ control_message_t sig = {0};
+ // Send acknowledgment signal up the tree to our parent
+ MPI_Send(&sig, sizeof(control_message_t), MPI_BYTE, parent,
+ CONTROL_SIGNAL, MPI_COMM_WORLD);
+
+ trace("%d: [CONTROL] Sent tree-signal to parent %d\n", my_id, parent);
+ parent = -1; // Detach from tree
+
+ }
+ }
+}
\ No newline at end of file