Namespaces
Variants

C++ attribute: optimize_for_synchronized (TM TS)

From cppreference.net
C++ language
General topics
Flow control
Conditional execution statements
Iteration statements (loops)
Jump statements
Functions
Function declaration
Lambda function expression
inline specifier
Dynamic exception specifications ( until C++17* )
noexcept specifier (C++11)
Exceptions
Namespaces
Types
Specifiers
constexpr (C++11)
consteval (C++20)
constinit (C++20)
Storage duration specifiers
Initialization
Expressions
Alternative representations
Literals
Boolean - Integer - Floating-point
Character - String - nullptr (C++11)
User-defined (C++11)
Utilities
Attributes (C++11)
Types
typedef declaration
Type alias declaration (C++11)
Casts
Memory allocation
Classes
Class-specific function properties
Special member functions
Templates
Miscellaneous
Attributes
(C++23)
(C++11) (until C++26)
(C++14)
(C++20)
(C++17)
(C++11)
optimize_for_synchronized
(TM TS)
(C++20)

함수 정의가 synchronized 문 에서의 호출에 최적화되어야 함을 나타냅니다.

목차

구문

[ [ optimize_for_synchronized ] ]

설명

함수 선언에서 선언되는 이름에 적용되며, 이는 해당 함수의 첫 번째 선언이어야 합니다.

함수 정의가 synchronized statement 에서의 호출에 최적화되어야 함을 나타냅니다. 특히, 대부분의 호출에 대해 transaction-safe하지만 모든 호출에 대해 그렇지는 않은 함수를 호출하는 synchronized block의 직렬화를 방지합니다.

예제

참고문헌

  • 트랜잭셔널 메모리 TS (ISO/IEC TS 19841:2015):
  • 7.6.6 동기화 블록 내 최적화를 위한 속성 [dcl.attr.sync]