Skip to content
Snippets Groups Projects
Commit 916ac1aa authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

get rid of the task lock as it is not needed.

parent 4ec0ff55
Branches
Tags
1 merge request!191Mpi skip
......@@ -565,9 +565,6 @@ struct task *scheduler_addtask(struct scheduler *s, int type, int subtype,
t->rid = -1;
t->last_rid = -1;
/* Init the lock. */
lock_init(&t->lock);
/* Add an index for it. */
// lock_lock( &s->lock );
s->tasks_ind[atomic_inc(&s->nr_tasks)] = ind;
......
......@@ -54,7 +54,7 @@ const char *taskID_names[task_type_count] = {
"split_cell", "rewait"};
const char *subtaskID_names[task_type_count] = {"none", "density", "force",
"grav"};
"grav", "t_end"};
/**
* @brief Computes the overlap between the parts array of two given cells.
......@@ -213,77 +213,6 @@ int task_lock(struct task *t) {
return 1;
}
/**
* @brief Remove all unlocks to tasks that are of the given type.
*
* @param t The #task.
* @param type The task type ID to remove.
*/
void task_cleanunlock(struct task *t, int type) {
int k;
lock_lock(&t->lock);
for (k = 0; k < t->nr_unlock_tasks; k++)
if (t->unlock_tasks[k]->type == type) {
t->nr_unlock_tasks -= 1;
t->unlock_tasks[k] = t->unlock_tasks[t->nr_unlock_tasks];
}
lock_unlock_blind(&t->lock);
}
/**
* @brief Remove an unlock_task from the given task.
*
* @param ta The unlocking #task.
* @param tb The #task that will be unlocked.
*/
void task_rmunlock(struct task *ta, struct task *tb) {
int k;
lock_lock(&ta->lock);
for (k = 0; k < ta->nr_unlock_tasks; k++)
if (ta->unlock_tasks[k] == tb) {
ta->nr_unlock_tasks -= 1;
ta->unlock_tasks[k] = ta->unlock_tasks[ta->nr_unlock_tasks];
lock_unlock_blind(&ta->lock);
return;
}
error("Task not found.");
}
/**
* @brief Remove an unlock_task from the given task.
*
* @param ta The unlocking #task.
* @param tb The #task that will be unlocked.
*
* Differs from #task_rmunlock in that it will not fail if
* the task @c tb is not in the unlocks of @c ta.
*/
void task_rmunlock_blind(struct task *ta, struct task *tb) {
int k;
lock_lock(&ta->lock);
for (k = 0; k < ta->nr_unlock_tasks; k++)
if (ta->unlock_tasks[k] == tb) {
ta->nr_unlock_tasks -= 1;
ta->unlock_tasks[k] = ta->unlock_tasks[ta->nr_unlock_tasks];
break;
}
lock_unlock_blind(&ta->lock);
}
/**
* @brief Prints the list of tasks contained in a given mask
*
......
......@@ -66,6 +66,7 @@ enum task_subtypes {
task_subtype_density,
task_subtype_force,
task_subtype_grav,
task_subtype_tend,
task_subtype_count
};
......@@ -79,8 +80,6 @@ struct task {
char skip, tight, implicit;
int flags, wait, rank, weight;
swift_lock_type lock;
struct cell *ci, *cj;
#ifdef WITH_MPI
......@@ -95,9 +94,6 @@ struct task {
};
/* Function prototypes. */
void task_rmunlock(struct task *ta, struct task *tb);
void task_rmunlock_blind(struct task *ta, struct task *tb);
void task_cleanunlock(struct task *t, int type);
void task_unlock(struct task *t);
float task_overlap(const struct task *ta, const struct task *tb);
int task_lock(struct task *t);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment