# Multithreaded Filtering

To ensure multithreaded filter processes are thread-safe, you must create a unique Filter context for every thread by instantiating a `Filter` object. In addition, threads must not share context objects, and the same context object must be used for all API calls in the same thread. Creating a context object for every thread does not affect performance because the context object uses minimal resources.

For example, your code should have the following logic in a thread:

    objFilter = new Filter();
    objFilter.FilterDirectory = m_filterDirectory;
    objFilter.SetInputSource(infile);
    objFilter.GetDocFormatInfo();

    if (objFilter.CanFilter() == true)

    objFilter.FilterTo(outfile);

    objFilter.ShutdownFilter();

_FT_HTML5_bannerTitle.htm