[][src]Function nvapi_sys::nvapi::NvAPI_Unload

pub unsafe fn NvAPI_Unload() -> NvAPI_Status

Decrements the ref-counter and when it reaches ZERO, unloads NVAPI library. This must be called in pairs with NvAPI_Initialize.

Unloading NvAPI library is not supported when the library is in a resource locked state. Some functions in the NvAPI library initiates an operation or allocates certain resources and there are corresponding functions available, to complete the operation or free the allocated resources. All such function pairs are designed to prevent unloading NvAPI library.

For example, if NvAPI_Unload is called after NvAPI_XXX which locks a resource, it fails with NVAPI_ERROR. Developers need to call the corresponding NvAPI_YYY to unlock the resources, before calling NvAPI_Unload again.

Note: By design, it is not mandatory to call NvAPI_Initialize before calling any NvAPI. When any NvAPI is called without first calling NvAPI_Initialize, the internal refcounter will be implicitly incremented. In such cases, calling NvAPI_Initialize from a different thread will result in incrementing the refcount again and the user has to call NvAPI_Unload twice to unload the library. However, note that the implicit increment of the refcounter happens only once. If the client wants unload functionality, it is recommended to always call NvAPI_Initialize and NvAPI_Unload in pairs.