Jump to content

  • Log In with Google      Sign In   
  • Create Account

Destroy a Shared Resource


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Dera Singh   Members   -  Reputation: 105

Like
0Likes
Like

Posted 11 June 2014 - 01:02 PM

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, 11 June 2014 - 01:56 PM.


Sponsor:

#2 iedoc   Members   -  Reputation: 967

Like
0Likes
Like

Posted 13 June 2014 - 02:22 PM

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


Braynzar Soft - DirectX Lessons & Game Programming Resources!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS