# Multithreaded Filtering

To make sure that multithreaded filter processes are thread-safe, each context pointer created using fpInit() or fpInitWithLicenseData() should only be used by a single thread. This applies to in-process and out-of-process API calls. Creating a context pointer for every thread does not affect performance because the context pointer uses minimal resources.

For example, C code for file filtering must have the following logic in a thread:

    fpInit()
       KVGetExtractInterface()
       fpOpenFile()
       fpGetMainFileInfo()            /* container file */
       fpGetSubFileInfo()
       fpExtractSubFile
       fpGetSubFileMetadata()
       fpFilterFile()
       fpCloseFile()

       fpOpenFile()
       fpGetMainFileInfo()            /* not a container file */
       fpGetDocInfoFile()
       fpGetOLESummaryInfoFile()
       fpFilterFile()
       fpCloseFile()
       ...
    fpShutdown()

_FT_HTML5_bannerTitle.htm