summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-22 11:01:14 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-22 11:01:14 +0200
commit0cdaa709676809d368cab23cfd10e6b147b4f38c (patch)
treec512d48e7cf82dca876fd76ee33aea3e20b4b495 /src
parent87d86fac572a93555dc0f72849cdc77bafe11eea (diff)
downloadedoors-0cdaa709676809d368cab23cfd10e6b147b4f38c.zip
edoors-0cdaa709676809d368cab23cfd10e6b147b4f38c.tar.gz
implement eiotas_spin_require_particle and eiotas_spin_release_particle
Diffstat (limited to 'src')
-rw-r--r--src/lib/eiotas_spin.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/eiotas_spin.c b/src/lib/eiotas_spin.c
index b10a6a3..3b14c96 100644
--- a/src/lib/eiotas_spin.c
+++ b/src/lib/eiotas_spin.c
@@ -22,6 +22,7 @@
#include "eiotas_spin.h"
#include "eiotas_iota.h"
+#include "eiotas_particle.h"
#include "eiotas_private.h"
EAPI Eiotas_Spin* eiotas_spin_add(const char* name, unsigned int step)
@@ -59,3 +60,20 @@ EAPI void eiotas_spin_free(Eiotas_Spin *spin)
free(spin);
}
+EAPI Eiotas_Particle* eiotas_spin_require_particle(Eiotas_Spin *spin)
+{
+ Eiotas_Particle *particle;
+ if(eina_array_count(spin->free_particles)>0) {
+ particle = eina_array_pop(spin->free_particles);
+ } else {
+ particle = (Eiotas_Particle*)eiotas_particle_alloc();
+ }
+ return particle;
+}
+
+EAPI Eiotas_Particle* eiotas_spin_release_particle(Eiotas_Spin *spin, Eiotas_Particle *particle)
+{
+ // TODO particle->reset();
+ eina_array_push(spin->free_particles,particle);
+}
+