9.27 __declspec(thread)

The __declspec(thread) attribute asserts that variables are thread-local and have thread storage duration, so that the linker arranges for the storage to be allocated automatically when a thread is created.

Note

The keyword __thread is supported as a synonym for __declspec(thread).

Restrictions

File-scope thread-local variables cannot be dynamically initialized.

Example

__declspec(thread) int i;
__thread int j;           // same as __decspec(thread) int j;
Non-ConfidentialPDF file icon PDF versionARM DUI0375F
Copyright © 2007, 2008, 2011, 2012, 2014 ARM. All rights reserved.