cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

MichaelChampigny
Journeyman III

Please reference count calInit and calShutdown

Avoiding thread-safe singletons (please)

Why are the calInit and calShutdown calls not reference counted (in a thread-safe way)? It's left to the client to manage the lifetime of these the CAL subsystem.

For building on top of CAL it's necessary to protect against nesting these calls. I could manage these in a threadsafe way myself using a singleton but it would be nice if CAL could do this for me. It only requires a thread-safe reference count under the hood.

 

0 Likes
1 Reply
JiaweiOu
Journeyman III

Originally posted by: MichaelChampigny Why are the calInit and calShutdown calls not reference counted (in a thread-safe way)? It's left to the client to manage the lifetime of these the CAL subsystem.

For building on top of CAL it's necessary to protect against nesting these calls. I could manage these in a threadsafe way myself using a singleton but it would be nice if CAL could do this for me. It only requires a thread-safe reference count under the hood.

I just wrote a post to complain the same problem: http://forums.amd.com/devforum/messageview.cfm?catid=328&threadid=108774

 

0 Likes