I did not fully understand, what you mean. But I can guess.

Maybe a solution is to replace the application scope variables with just 
global variables. The it is up to you when to lock and unlock. The 
scopes are designed so that they work always and always locked properly. 
And application scope depends on session scope. It is important, that 
the scopes are always locked and unlocked in the right order to prevent 
dead locks.

If one request lock the application scope and another locks the session 
scope. Later in the request the first needs access to the session scope 
and the other needs access to the application scope. Both try to lock 
the desired scope and both will wait forever. Hence it is necessary, 
that the application scope is locked only when the session scope is 
locked already.

The ApplicationUnlocker is a helper which is useful, when a request 
blocks for a longer time but do not want to block other requests. For 
example when it executes a longer database query it is not desired to 
block other requests. But to make it safe, it locks the application 
scope when the scope is left, so that it is again guaranteed, that the 
user can safely access application scope variables.


Tommi


Am 06.02.2015 um 15:39 schrieb Jouven:
> Greetings,
>
> I've been investigating a way to properly unlock
> TNT_APPLICATION_SHARED_VAR/TNT_APPLICATION_GLOBAL_VAR (global
> application) variables, because when one is used every call to a
> component that shares it gets blocked until the component call that
> locked it first ends.
>
> I found applicationunlocker.h, but the class ApplicationUnlocker
> "Unlocks the application (and session) as long as the object is in
> scope." (comment in the same file about the class) which is an overkill
> for me and breaks my global session variables in use, session variables
> can block all the way since they only affect the one browser-connection
> using it and inherently prevent it from doing lots of operations on the
> server at the same time. Then again if I sort my code to use the global
> application variables before using the session variables I can manage.
>
> Can it be done so the ApplicationUnlocker class unlocks application
> variables alone? or are they are dependent?
>
> Regards.
> Joan
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Tntnet-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tntnet-general


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to