librelist archives

« back to archive

Thread-Safe ?

Thread-Safe ?

From:
Stephane Wirtel
Date:
2010-05-17 @ 11:46
Hi all,

About the g instance, is it thread-safe ?

Regards

Re: [flask] Thread-Safe ?

From:
Armin Ronacher
Date:
2010-05-17 @ 12:26
Hi,

On 5/17/10 1:46 PM, Stephane Wirtel wrote:
> About the g instance, is it thread-safe ?
Short answer: yes.

Long answer: there is no such thing as universal thread-safety.  There 
are different behaviours associated with multithreading.  The behaviour 
the g object follows is: each thread has its own storage unit.

In that sense it is thread safe, but the more correct term would 
probably be thread local.


Regards,
Armin

Re: [flask] Thread-Safe ?

From:
Stephane Wirtel
Date:
2010-05-17 @ 12:35
Armin,

Thank you,

On 05/17/2010 02:26 PM, Armin Ronacher wrote:
> Hi,
> 
> On 5/17/10 1:46 PM, Stephane Wirtel wrote:
>> About the g instance, is it thread-safe ?
> Short answer: yes.
> 
> Long answer: there is no such thing as universal thread-safety.  There 
> are different behaviours associated with multithreading.  The behaviour 
> the g object follows is: each thread has its own storage unit.
> 
> In that sense it is thread safe, but the more correct term would 
> probably be thread local.
> 
> 
> Regards,
> Armin