summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-03-03 18:01:05 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-03-03 18:01:05 +0900
commitaabbb211eab1022b39805fa45af581b41c6bea56 (patch)
treec95e0ce2d5e8cbd2d9f97d290a78854234783f95
parent6c0ed8fe76fed8aec8c8cbaac58c30f289c0e098 (diff)
downloadefl-aabbb211eab1022b39805fa45af581b41c6bea56.tar.gz
efl.task - add an api to clear environment
-rw-r--r--src/lib/ecore/efl_loop.c15
-rw-r--r--src/lib/ecore/efl_loop.eo1
-rw-r--r--src/lib/ecore/efl_task.c7
-rw-r--r--src/lib/ecore/efl_task.eo3
4 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/ecore/efl_loop.c b/src/lib/ecore/efl_loop.c
index b3a58f9ae9..f4dd2bf246 100644
--- a/src/lib/ecore/efl_loop.c
+++ b/src/lib/ecore/efl_loop.c
@@ -901,6 +901,21 @@ _efl_loop_efl_task_env_get(Eo *obj, Efl_Loop_Data *pd, const char *var)
return efl_task_env_get(efl_super(obj, EFL_LOOP_CLASS), var);
}
+EOLIAN static void
+_efl_loop_efl_task_env_reset(Eo *obj EINA_UNUSED, Efl_Loop_Data *pd)
+{
+ Efl_Task_Data *td = efl_data_scope_get(obj, EFL_TASK_CLASS);
+ if (!td) return;
+ eina_lock_take(&_environ_lock);
+#ifdef HAVE_CLEARENV
+ clearenv();
+#else
+ environ = NULL;
+#endif
+ _env_sync(pd, td);
+ eina_lock_release(&_environ_lock);
+}
+
EOLIAN static Eina_Bool
_efl_loop_efl_task_run(Eo *obj, Efl_Loop_Data *pd EINA_UNUSED)
{
diff --git a/src/lib/ecore/efl_loop.eo b/src/lib/ecore/efl_loop.eo
index 1ecdd68538..6531086fd8 100644
--- a/src/lib/ecore/efl_loop.eo
+++ b/src/lib/ecore/efl_loop.eo
@@ -127,6 +127,7 @@ class Efl.Loop (Efl.Task)
Efl.Object.destructor;
Efl.Object.provider_find;
Efl.Task.env { set; get; }
+ Efl.Task.env_reset;
Efl.Task.run;
Efl.Task.end;
}
diff --git a/src/lib/ecore/efl_task.c b/src/lib/ecore/efl_task.c
index 9a727743ed..d269773117 100644
--- a/src/lib/ecore/efl_task.c
+++ b/src/lib/ecore/efl_task.c
@@ -344,6 +344,13 @@ _efl_task_env_get(Eo *obj EINA_UNUSED, Efl_Task_Data *pd, const char *var)
}
EOLIAN static void
+_efl_task_env_reset(Eo *obj EINA_UNUSED, Efl_Task_Data *pd)
+{
+ if (pd->env) eina_hash_free(pd->env);
+ pd->env = NULL;
+}
+
+EOLIAN static void
_efl_task_priority_set(Eo *obj EINA_UNUSED, Efl_Task_Data *pd, Efl_Task_Priority priority)
{
pd->priority = priority;
diff --git a/src/lib/ecore/efl_task.eo b/src/lib/ecore/efl_task.eo
index e44f929590..26ecb4b5a5 100644
--- a/src/lib/ecore/efl_task.eo
+++ b/src/lib/ecore/efl_task.eo
@@ -108,6 +108,9 @@ class Efl.Task (Efl.Object, Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer)
is $NULL or if it is an empty string ]]
}
}
+ env_reset {
+ [[ Clear all environment variables. ]]
+ }
@property priority {
[[ The priority of this task. ]]
get { }