Re: thread local variable
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Fri, 17 Aug 2007 12:45:05 +0200
Alex Blekhman wrote:
`__declspec(thread)' modifier can be applied to static variables only.
Hmmm, that statement is pretty misleading, 'static' is not sufficient to
describe the requirement:
namespace answer {
int __declspec(thread) fourtytwo;
}
This is perfectly valid without any 'static'. Further, the 'namespace' is
only to demonstrate that the declaration is not local or at class scope, it
could have been in the global namespace or an anonymous one, too.
* You can specify the thread attribute only on data items
with static storage duration.
"static storage duration" is the key here, variables at namespace scope also
fall under this category.
Uli
.
- Follow-Ups:
- Re: thread local variable
- From: Mark Salsbery [MVP]
- Re: thread local variable
- From: Alex Blekhman
- Re: thread local variable
- References:
- Re: thread local variable
- From: Alex Blekhman
- Re: thread local variable
- Prev by Date: Template member function cast bug in VC80SP1 (and more...)
- Next by Date: Re: thread local variable
- Previous by thread: Re: thread local variable
- Next by thread: Re: thread local variable
- Index(es):
Relevant Pages
|
Loading