cgSetLockingPolicy(3)

NAME
cgSetLockingPolicy - set locking policy

SYNOPSIS
  #include <Cg/cg.h>

  CGenum cgSetLockingPolicy( CGenum lockingPolicy );

PARAMETERS

lockingPolicy
    An enumerant describing the desired locking policy for the library. The following enumerants are allowed:

    CG_THREAD_SAFE_POLICY
        Locks will be used to serialize thread access to the library.

    CG_NO_LOCKS_POLICY
        Locks will not be used.

RETURN VALUES
Returns the previous locking policy, or CG_UNKNOWN if an error occurs.

DESCRIPTION
cgSetLockingPolicy allows an application to change the locking policy used by the Cg library. The default policy is CG_THREAD_SAFE_POLICY, meaning a lock is used to serialize access to the library by mulitiple threads. Single threaded applications can change this policy to CG_NO_LOCKS_POLICY to avoid the overhead associated with this lock. Multithreaded applications should never change this policy.

EXAMPLES
  /* multithreaded apps should *never* do this */
  cgSetLockingPolicy(CG_NO_LOCKS_POLICY);

ERRORS
CG_INVALID_ENUMERANT_ERROR is generated if lockingPolicy is not CG_NO_LOCKS_POLICY or CG_THREAD_SAFE_POLICY.

HISTORY
cgSetLockingPolicy was introduced in Cg 2.0.

SEE ALSO
cgGetLockingPolicy