allow threads to be created by library user
Allow user to create his own thread. As such he may specify stack sizes, priorities, processor affinity, store thread local data, ... When fully configured, the newly created thread should call some Wt (WServer?) entry point.
Updated by Koen Deforche about 12 years ago
in what way can a user not do all this while handling a request ?
i.e. check the value of a particular thread local variable, if it is 0, then do all this and set a value for that thread local variable (so that you do not repeat this work again).
The overhead of checking the value for that thread local variable on each request is negligible compared to how many times the library does this internally (when calling WApplication::instance()).
Updated by Christophe Delépine about 12 years ago
I have my own "Thread" C class that offers communication services (messages, synchronization..).
When handling a request, i need to send messages and synchronize with my application's threads.
Since Wt creates threads by itself, i cannot use any method from my Thread class since the thread in which the request is processed is not a Thread instance but a Wt thread.
Therefore i had to use a non multithreaded build of Wt in order to have control on the creation of the thread that runs the web server and event loop.
Besides, it is more natural to assign priority, processor affinity.. at the very beginning of the thread main entry point and not wait for a request that may arrive much later or never..