There are several threadsafe mechanisms to submit a new job to complete the processing you need.
The server job cannot perform normal I/O without conflicting with the application I/O processing. The application I/O processing can affect file offsets or locks that are maintained on system objects. Attempts at I/O can conflict between the jobs.
Passing pointers or other types of complex parameters to the functions that are not threadsafe might not be easy to accomplish. That function runs in a separate job. You need to solve the problems involved with passing complex data to that function.
The results from the function that is not threadsafe might be more complex than the simple pass/fail type of information that is provided by some of the mechanisms described above. This is similar to the parameter passing issue described above.
You might have additional complexity to manage when trying to duplicate your application's environment in the server job. For example, if you started your application as user ALICE, and you started the server job as user BOB, the application behavior is not correct.