This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Cleaning up after timer_delete
2009/7/25 Rémi Denis-Courmont <remi@remlab.net>:
> I want to know that there threads are _terminated_ so that I can release data
> that those threads use. I cannot release data if threads are still using it,
> regardless of when they were created.
>
> And I cannot release data from the timer callback either because I do not know
> which thread is "the last one". There could be *more* than one thread still
> running after timer_delete() afterall.
After reading the code more I don't think you can know when the
threads have terminated, but I don't know that you need this
information.
I think the solution is going to be the other way around, the callback
has to know you are about to delete the timer and avoid touching the
resource.
Isn't this simply a synchronization problem, you have an unknown
number of threads using a single resource you want to delete.
Protect the resource with a lock?
Cheers,
Carlos.