Hey Francesco,

2011/8/17 Francesco Basile <[email protected]>:
> I've encountered a problem while using interacting threads in
> WTestEnviroment. The problem my be summarized in the following code.
> It seems that the update lock of an application living in WTestEnvironment
> may not be taken by threads different from the environment's one.
>
> Any suggestion?

The problem is that your 'main' thread already has a lock on the
application, and thus other threads will be waiting indefinitely.

Unfortunately, we didn't think of this use-case. We would need some
way to add to the test environment some way to simulate multiple
requests, which have the implicit side effect to unlock the
application update lock in between those requests.

e.g.

> int main() {
>   const Wt::Test::WTestEnvironment myEnvironment;
>   Wt::WApplication myApplication(myEnvironment);
>
>   Updater myUpdater(&myApplication);
>   boost::thread myThread(myUpdater);

myEnvironment.finishRequest();
sleep(1);
myEnvironment.startRequest();

>   myThread.join();
> }

Perhaps "request" isn't the right term here, since it hints to a wrong
level of abstraction.

Regards,
koen

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to