- oracle
- LSL_Script
- 다빈치 리졸브
- postman pre-request
- 좋은 개발자
- postman session
- postman
- emplace_back
- postman collection
- 우수한 프런트 개발자
- postman html parse
- postman tests
- c#
- C++
- Unity
- postman csv
- UI/UX Engineer
- postman collection variables
- 프런트엔드
- solidity
- Front-end developer
- postman excel
- Android/iOS Developer
- web developer
- Interaction developer
- Android
- MFC
- postman automations
- Intellij
- Java
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Today
- Total
david's daily developer note
[C,C++] Magic Static (Dynamic Initialization and Destruction with Concurrency) 본문
[C,C++] Magic Static (Dynamic Initialization and Destruction with Concurrency)
mouse-david 2018. 12. 19. 17:21VC 11 이상, Visual Studio 2015 이상 버전에서 Magic Static이 적용되었다.
항상 골치아픈 동시성(Concurrency) 이슈와 관련된 내용이다.
https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)
lock과 TLS(Thread Local Storage) 개념을 사용하여 정적 싱글톤 변수 생성을 Thread-Safe하도록 표준에 추가한 것이다.
기존 코드와 Magic Static을 적용한 코드에 대한 예제는 아래 문서에서 확인하자.
Support For C++11-14-17 Features (Modern C++)
Table of contents Support For C++11/14/17 Features (Modern C++) Article 06/05/2017 13 minutes to read In this article --> The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com. This article describes C++11/1
docs.microsoft.com
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2660.htm
Dynamic Initialization and Destruction with Concurrency
This document is a revision of N2513 = 08-0023 - 2008-02-01. The change consists of Concurrency introduces potential deadlock or data races in the dynamic initialization and destruction of static-duration objects. Because the opportunity for programmers to
www.open-std.org
추가적으로 VS 프로젝트 명령줄 옵션에서 "/Zc:threadSafeInit-"를 추가하여 비활성화 시킬 수있다.
다양한 응용 상황에서 언급한 옵션을 사용할 수 있는데, 특히 플랫폼 도구 집합에서 WindowXp로 설정한 경우에는
Magic Static 반영 코드의 변수 초기화가 잘못되어 문제를 발생시킬 수 있는데(XP는 TLS 개념이 없다함) 서비스되는 제품이
XP를 지원한다면 반드시 검토해보아야 할 것이다.
'[Develop] Native > C++ , C' 카테고리의 다른 글
[C++] 최대값, 최소값 (0) | 2022.11.06 |
---|---|
[C,C++] East Const (0) | 2018.12.20 |
[C,C++] __func__ (0) | 2018.12.19 |
[C,C++] copy constructor (0) | 2018.06.26 |
[C,C++] memory fragmentation - struct packing (2) | 2018.05.29 |