/GT (Support Fiber-Safe Thread-Local Storage)
For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.
Supports fiber safety for data allocated using static thread-local storage, that is, data allocated with
Data declared with
__declspec(thread) is referenced through a thread-local storage (TLS) array. The TLS array is an array of addresses that the system maintains for each thread. Each address in this array gives the location of thread-local storage data.
A fiber is a lightweight object that consists of a stack and a register context and can be scheduled on various threads. A fiber can run on any thread. Because a fiber may get swapped out and restarted later on a different thread, the address of the TLS array must not be cached or optimized as a common subexpression across a function call (see the /Og (Global Optimizations) option for details). /GT prevents such optimizations.
Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
Click the C/C++ folder.
Click the Optimization property page.
Modify the Enable Fiber-safe Optimizations property.