Am 15.03.2013 16:04, schrieb Julian Wiesener:
> Hi,
>
> On Fri, 2013-03-15 at 15:18 +0100, Jean-Marc Choulet wrote:
>> <%session>
>> A a;
>> </%session>
>>
>> I think I must use Mutex in add function , but how ?
> you don't need to, variables in the session scope are implicit protected
> by a mutex, adding a mutex here, would be redundant.
>
>
>
> The semantic for cxxtools::Mutex however is the following. But be
> warned, the mutex is not per session.
>
> #include <cxxtools/mutex.h>
> //...
> {
> cxxtools::Mutex mutex
> std::verctor<int> shared_vec;
> {
> cxxtools::MutexLock lock(mutex); // lock mutex
> shared_vec.puth_back(1);
> } // release mutex lock
> ...
> }
>
Not quite correct. You have to make the cxxtools::Mutex static.
Otherwise a new mutex is created for every call.
Tommi
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general