Hello, we are developing a multi-threaded web-application using the Wt Web Toolkit; for all multi-threading related purposes, we are using the appropriate classes from boost (thread, mutex etc.). Now here is our problem: Usually, you use WApplication::instance() to access the current session's application object. In order to let a second thread trigger updates, we need to call WApplication::instance()->attachThread() from inside the second thread. However, whenever called from within a seperate thread, we found WApplication::instance() to return NULL. So far I have come to the assumption that each additional thread is totally seperated from the main thread as if it were a new session, hence the need for attachThread; in a different project, the problem did not arise (probably) because the seperate thread was in fact a member function of an object which inherits from WApplication, and thus has the implicit this-pointer to call attachThread. We may work around this by retrieving the pointer returned from WApplication::instance() and pass it to the second thread via boost::bind, or any mechanism that stores the actual pointer before the creating of the thread. It would also work if the second thread were a member function of our class derived from WApplication, however this would go against the specific design approach in the current project and is thus not an option for us. On a slightly related note, is this also why singleton objects and static class members are still individual for each thread? Thanks in advance for your answer, Marcus Fleischer
------------------------------------------------------------------------------
_______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
