summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/eiotas_spin.h5
-rw-r--r--src/lib/eiotas_spin.c18
2 files changed, 13 insertions, 10 deletions
diff --git a/src/include/eiotas_spin.h b/src/include/eiotas_spin.h
index 326164c..009b7c7 100644
--- a/src/include/eiotas_spin.h
+++ b/src/include/eiotas_spin.h
@@ -23,6 +23,7 @@
#include "eiotas_iota.h"
#include "eiotas_particle.h"
+#include <eina_list.h>
#include <eina_array.h>
typedef struct _Eiotas_Spin Eiotas_Spin;
@@ -30,8 +31,8 @@ typedef struct _Eiotas_Spin Eiotas_Spin;
struct _Eiotas_Spin {
Eiotas_Room room; /* higher level Room */
Eina_Array *free_particles; /* lifo of free to reuse Particles TODO support different particle types, use an Eina_Hash */
- Eina_Array *app_fifo; /* fifo of application priority particles */
- Eina_Array *sys_fifo; /* fifo of system priority particles */
+ Eina_List *app_fifo; /* fifo of application priority particles */
+ Eina_List *sys_fifo; /* fifo of system priority particles */
};
EAPI void eiotas_spin_free(Eiotas_Spin *spin);
diff --git a/src/lib/eiotas_spin.c b/src/lib/eiotas_spin.c
index 783de18..a99c9d1 100644
--- a/src/lib/eiotas_spin.c
+++ b/src/lib/eiotas_spin.c
@@ -30,8 +30,8 @@ EAPI Eiotas_Spin* eiotas_spin_add(const char* name, unsigned int step)
spin->room.links = NULL; /* not used */
spin->room.children = eina_hash_stringshared_new((Eina_Free_Cb)&eiotas_iota_free);
spin->free_particles = eina_array_new(step);
- spin->sys_fifo = eina_array_new(step);
- spin->app_fifo = eina_array_new(step);
+ spin->sys_fifo = NULL;
+ spin->app_fifo = NULL;
return spin;
}
@@ -41,17 +41,19 @@ EAPI void eiotas_spin_free(Eiotas_Spin *spin)
unsigned int i;
Eiotas_Particle *particle;
Eina_Array_Iterator iterator;
+ Eina_List *list;
+ Eina_List *l;
DBG("Spin free 0x%X",PRINTPTR(spin));
eiotas_iota_desinit(&spin->room.iota);
eina_hash_free(spin->room.children);
EINA_ARRAY_ITER_NEXT(spin->free_particles, i, particle, iterator) eiotas_particle_free(particle);
- EINA_ARRAY_ITER_NEXT(spin->sys_fifo, i, particle, iterator) eiotas_particle_free(particle);
- EINA_ARRAY_ITER_NEXT(spin->app_fifo, i, particle, iterator) eiotas_particle_free(particle);
eina_array_free(spin->free_particles);
- eina_array_free(spin->sys_fifo);
- eina_array_free(spin->app_fifo);
+ EINA_LIST_FOREACH(spin->sys_fifo, l, particle) eiotas_particle_free(particle);
+ eina_list_free(spin->sys_fifo);
+ EINA_LIST_FOREACH(spin->app_fifo, l, particle) eiotas_particle_free(particle);
+ eina_list_free(spin->app_fifo);
free(spin);
}
@@ -76,9 +78,9 @@ EAPI void eiotas_spin_release_particle(Eiotas_Spin *spin, Eiotas_Particle *parti
EAPI void eiotas_spin_send_particle(Eiotas_Spin *spin, Eiotas_Particle *particle, Eina_Bool system)
{
if(system) {
- eina_array_push(spin->sys_fifo,particle);
+ spin->sys_fifo = eina_list_append(spin->sys_fifo,particle);
} else {
- eina_array_push(spin->app_fifo,particle);
+ spin->app_fifo = eina_list_append(spin->app_fifo,particle);
}
}