Multiple Threads using Codec Engine Handle
From Texas Instruments Embedded Processors Wiki
Within a process, all threads can technically share the same Engine handle returned from Engine_open(). However, as documented in the Engine_open() API Reference Guide, this Engine handle is not thread safe, meaning only one thread should us it at a time.
The common, and recommended usage for multi-threaded applications is to, rather than have one thread obtain Engine handle and share it, have each thread independently call Engine_open() to obtain its own Engine handle. As expected, before exiting, each thread should also call Engine_close().
The order is not important. In homogeneous multicore systems, the slave will be loaded when the first thread calls Engine_open(); other Engine_open() calls will return unique Engine handles, and increment a reference count on the slave device. Once the last thread calls Engine_close(), the reference count will reach zero and the slave will be unloaded/stopped.
Finally, note that these details are all local to a single process. When multiple applications may need to use a slave processor, they should be configured to use the Link Arbiter Daemon - LAD.
Leave a CommentComments
Comments on Multiple Threads using Codec Engine Handle

This article is probably too short to live on its own and should be merged into a FAQ and/or users guide.
--ChrisRing 11:15, 8 April 2011 (CDT)