• Advertisement
Sign in to follow this  

Destroy a Shared Resource

This topic is 1316 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I am new to DirectX programming, and I have started with DirectX9.

I have created a shared resource which gets opened in another process, my doubt is do both the processes call DestroyResource on this shared resource?

If the process which created the resource in the first place calls DestroyResource and the resource is destroyed then what happens to the process which has opened this resource when it tries to access this shared resource?

 

Thanks.

Edited by Dera Singh

Share this post


Link to post
Share on other sites
Advertisement

you don't want to do it like that, because if you destroy the resource when another process is using it, then that could result in a null pointer exception. What you want to do is have a resource manager. it could be extremely simple. all you need to do is load in a resource and store it in the resource manager when its needed. for any process that is using that resource, increment the resource reference count. when a process is finished using the resource, decrement the reference count. when the reference count equals zero or less, destroy that resource.

 

if you need a little more of an idea of how you would implement this, i can give you some advice

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement