Hi,

Linux-generic pool implementation has a bug ( 
https://bugs.linaro.org/show_bug.cgi?id=1851 ) that prevents dynamic pool 
destroy. From API point of view, any resource (e.g. pool) is created once ( 
xxx_create call returns a handle) and destroyed once (pass the handle to 
xxx_destroy). Any thread can create a resource and any thread can destroy it. 
Application threads  must synchronize resource usage and destroy call, but not 
implementation specifics like potential usage of per thread stashes or flush of 
those.

For example, this valid usage of the pool API:

Thread 1            Thread 2              Thread 3
--------------------------------------------------

init_global()
init_local()        init_local()          init_local()

                    pool = pool_create()

barrier()           barrier()             barrier()
buf = alloc(pool)   buf = alloc(pool)     buf = alloc(pool)
free(buf)           free(buf)             free(buf)
barrier()           barrier()             barrier()

pool_destroy(pool)

barrier()           barrier()             barrier()
do_something()      do_something()        do_something()
term_local()        term_local()          term_local()
                                          term_global()


So, e.g. pool_destroy must succeed when all buffers have been freed before the 
call - no matter:
* which thread calls it
* has the calling thread itself called alloc or free
* have other threads called already term_local


-Petri


_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to