2010/9/7 HADASS YAARI <[email protected]>:
> Hi Wim,
>
> I have a few questions regarding the threads created by the WT library:
>
> 1.       How many threads are created?
>

That depends on compilation and configuration options.
- If MULTI_THREADED is set to OFF during cmake configuration, Wt will
not rely on any threading functionality. It will not create any thread
and will not use any locking primitives. Modifcation of the widget
tree outside of the thread that the server is started in is not
possible, as you cannot protect the widget tree from concurrent access
- If MULTI_THREADED is ON (the default), wt creates a thread pool. The
size of this thread pool is configured in wt_config.xml for the fcgi
connector and the isapi connector, or as a command line parameter for
the http connector (run your program with --help to see all options).
- When using the http the main thread is usually (default
implemenation of WRun()) used to wait until the server is terminated
by calling WServer::waitForShutdown() (e.g. Ctrl-C, SIGHUP, ...), but
is never part of the threadpool that processes requests. You can use
the main thread for anything else if you don't want to do this by
reimplementing WRun
- When using the fcgi connector, the main thread is unused after
starting up the server. It never returns,
- The isapi connector has no 'main' thread, only the application pool,
which is created when the extension is loaded in IIS

> 2.       When are they created?
>
The threadpool is created shortly after calling WServer::start()

> 3.       When are they released?
>
Threads are joined when the server is stopped by calling
WServer::stop(). stop() will therefore only return after the threads
are 'released'

> 4.       What is their default priority, and how can I change it?
>
Wt does not set the thread's priority. Changing the thread's priority
is OS dependent; the best method to implement this is currently to set
the right priority by reimplementing WApplication::notify()

BR,
Wim.

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to