Skip to content
Snippets Groups Projects
Commit 0bf7f33c authored by Alexandru BRĂSLAŞU's avatar Alexandru BRĂSLAŞU
Browse files

TEMA3SO

parent 609878b9
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
......@@ -42,9 +42,13 @@ static void process_node(unsigned int idx)
pthread_mutex_unlock(&tp->mutexSuma);
graph->visited[idx] = DONE;
for (unsigned int i = 0; i < graph->nodes[idx]->num_neighbours; ++i) {
pthread_mutex_lock(&tp->mutexCoada);
int node = graph->visited[graph->nodes[idx]->neighbours[i]];
pthread_mutex_unlock(&tp->mutexCoada);
if (node == NOT_VISITED) {
pthread_mutex_lock(&tp->mutexCoada);
graph->visited[graph->nodes[idx]->neighbours[i]] = PROCESSING;
pthread_mutex_unlock(&tp->mutexCoada);
os_arg_t *arg = malloc(sizeof(*arg));
arg->x = graph->nodes[idx]->neighbours[i];
......@@ -59,8 +63,7 @@ static void process_node(unsigned int idx)
int verifProcessing()
{
for (unsigned int i = 0; i < graph->num_nodes; ++i) {
int visit = graph->visited[i];
if (visit == PROCESSING)
if (graph->visited[i] == PROCESSING)
return 1;
}
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment