ResourceLib::BindResourceKey

ResourceLib::BindResourceKey
inline ResolveState BindResourceKey(BindHandle * phandle, const ResourceKey & k);
Description

BindResourceKey obtains a resource key and creates a bind handle to add resource to the library in a synchronized manner. 

If the bind status returned by BindResourceKey is RS_NeedsResolve, a thread can load a resource into the library using ResolveResource or cancel loading with CancelResolve. Thus if a second thread comes to load the same resource, then the bind status returned by the BindResourceKey function will be RS_WaitingResolve, allowing the second thread to wait for resource loading completion. Once the first thread is done loading and resolves the resource, WaitForResolve will return the resource with its content appropriately shared.

Parameters
Parameters 
Description 
BindHandle * phandle 
BindHandle to bind a resource. 
const ResourceKey & k 
Resource key. 
Return Value

Bind Status or the ResolveState based on which a thread loads a resource or waits for it.