diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-22 11:01:14 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-05-22 11:01:14 +0200 |
commit | 0cdaa709676809d368cab23cfd10e6b147b4f38c (patch) | |
tree | c512d48e7cf82dca876fd76ee33aea3e20b4b495 | |
parent | 87d86fac572a93555dc0f72849cdc77bafe11eea (diff) | |
download | edoors-0cdaa709676809d368cab23cfd10e6b147b4f38c.zip edoors-0cdaa709676809d368cab23cfd10e6b147b4f38c.tar.gz |
implement eiotas_spin_require_particle and eiotas_spin_release_particle
-rw-r--r-- | src/lib/eiotas_spin.c | 18 |
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); +} + |