Luxand FaceSDK v8.3 Developer's Guide

Thread Safety

This chapter describes using FaceSDK in applications that execute FaceSDK functions from multiple threads. If your program runs in a single thread (by default, this happens in almost all environments), you can skip this chapter.

Most FaceSDK functions are safe for multithreaded operations. The functions not guaranteed to be thread-safe are:

FSDK_Initialize
FSDK_Finalize
FSDK_ActivateLibrary
FSDK_GetLicenseInfo
FSDK_GetHardware_ID
FSDK_SetNumThreads

When working with cameras in multiple threads on Windows platforms, make sure that each thread calls the FSDK_InitializeCapturing function and the FSDK_FinalizeCapturing function when the thread is done. The following functions are thread safe (on all supported platforms) given that no different threads are simultaneously accessing the same camera handle:

FSDK_GetVideoFormatList
FSDK_FreeVideoFormatList
FSDK_SetVideoFormat
FSDK_OpenVideoCamera
FSDK_CloseVideoCamera
FSDK_GrabFrame

The following functions set global parameters that have effect on each thread:

FSDK_SetFaceDetectionParameters
FSDK_SetFaceDetectionThreshold
FSDK_SetJpegCompressionQuality
FSDK_SetCameraNaming
FSDK_SetHTTPProxy
FSDK_SetNumThreads

Note that HImage is safe only for multiple simultaneous reads or single write. Do not read from (e.g. with FSDK_DetectFace) and write to (e.g. with FSDK_FreeImage) the same HImage handle at one time.

For more information on thread safety of Tracker API, see the Thread Safety section in the Tracker API chapter.