05-14-2018, 04:04 AM
In theory, it should work as a thread in the ServerController. I have a thread of my own that I create in the ServerController.OnCreate event. It has functions that I use in certain forms launched by the user.
Your final results will depend upon the functionality of your specific thread. You should try adding your thread unit to the project, and then instantiate it the ServerController. Compile it to see if you have any dependencies that also have to be included. Run your app to see if it still runs and supports sessions.
Since you are sharing it among sessions you may have to use TCriticalSections if you have code that should not be accessed by more than one thread at a time.
Your final results will depend upon the functionality of your specific thread. You should try adding your thread unit to the project, and then instantiate it the ServerController. Compile it to see if you have any dependencies that also have to be included. Run your app to see if it still runs and supports sessions.
Since you are sharing it among sessions you may have to use TCriticalSections if you have code that should not be accessed by more than one thread at a time.