Cleaning up a resource manager

I started my resource manager by calling
dispatch_create()
iofunc_func_init()
resmgr_attach() many times
dispatch_context_alloc()

What’s necessary to fully clean up the resource manager?
dispatch_context_free()
dispatch_destroy()

Since the resmgr_attach()es were associated with the dispatch handle, will
they be cleaned up automatically for me when I call dispatch_destroy(), or
do I need to call resmgr_detach() once for each attach?

Normally when I call exit() this is all handled quite nicely for me, but now
my resource manager is part of a bigger process and I have to clean myself
up without exiting (doh).

Thanks,
Shaun

Shaun Jackman <sjackman@nospam.vortek.com> wrote:

Since the resmgr_attach()es were associated with the dispatch handle, will
they be cleaned up automatically for me when I call dispatch_destroy(), or
do I need to call resmgr_detach() once for each attach?

No, dispatch_destroy() basically just frees memory. You’ll need to
detach all the paths yourself (with resmgr_detach() using the id that
was returned by resmgr_attach()).

I found though that all the paths I attached disappear after destroying my
dispatcher. Is there any need then to call resmgr_detach()? Does it
deallocate any memory that will otherwise leak?

Thanks,
Shaun

No, dispatch_destroy() basically just frees memory. You’ll need to
detach all the paths yourself (with resmgr_detach() using the id that
was returned by resmgr_attach()).

Since the resmgr_attach()es were associated with the dispatch handle,
will
they be cleaned up automatically for me when I call dispatch_destroy(),
or
do I need to call resmgr_detach() once for each attach?

Shaun Jackman <sjackman@nospam.vortek.com> wrote:

I found though that all the paths I attached disappear after destroying
my dispatcher. Is there any need then to call resmgr_detach()?

Are you sure? Or have they just become inaccessable because the channel
has been destroyed (the only other thing dispatch_destroy() does :wink:?!

Does it deallocate any memory that will otherwise leak?

As well as releasing the pathname resources it will also arrange to
close() any open instances of itself. You should call this routine.

Anyway, isn’t the source available at cvs.qnx.com, so you can see yourself?