Actions
Bug #465
closed
FI
AM
Filling the task field in the activity structure...
Bug #465:
Filling the task field in the activity structure...
Description
struct genom_activity has an unused field void *task; /* task or NULL (ctrl) */ why not use it?
I use it in the genom3-fiacre-pocolibs template to retrieve the context from the activity. So here is my proposition as to "properly" set it.
Note that the field is void * probably as we do not know the exact task struct which will end up here.
(venv) calcifer-adaptateur3:genom3-pocolibs felix$ git diff
diff --git a/server/control_task.c b/server/control_task.c
index 5203151..71ba53f 100644
--- a/server/control_task.c
+++ b/server/control_task.c
@@ -359,6 +359,7 @@ static void
/* get an activity slot */
<' if {[catch {$s task} t]} {'>
activity = &self->control.activity;
+ activity->any.task = NULL;
<' } else {'>
pthread_mutex_lock(&self->tasks.<"[$t name]">_.lock);
int id = genom_<"$comp">_activity_alloc(&self->tasks.<"[$t name]">_.activities);
@@ -372,6 +373,7 @@ static void
}
activity = &self->tasks.<"[$t name]">_.activities.a[id];
pthread_mutex_unlock(&self->tasks.<"[$t name]">_.lock);
+ activity-><"[$s name]">_.h.task = &self->tasks.<"[$t name]">_;
<' }'>
a = &activity-><"[$s name]">_;
genom_tinit_<"$comp">_activity_<"[$s name]">(a);
FI Updated by Félix Ingrand 25 days ago
By the way, why are control_task.c and exec_task.c using underscore _, while most other filenames use dash - ?
AM Updated by Anthony Mallet 24 days ago
- Status changed from New to Closed
Applied in changeset genom3:genom3|8c40d6c80dd2230f9996da44a38a32b51fe3b209.
Actions