template <typename T> class SharedHandle final {...};
Handle to a File Storage or Key-Value Storage. A SharedHandle is returned by the functions OpenFileStorage() and OpenKeyValueStorage() and can be passed between threads as needed. It provides the abstraction that is necessary to allow thread-safe implementation of OpenFile Storage() and OpenKeyValueStorage().
스레드 경계를 넘어 파일 및 키-값 스토리지에 대한 스레드 안전한 접근을 가능하게 합니다.
AI 생성미검증모델: gemini-3.8-flash-medium · 노력: medium · 온도: 제어 불가 · 프롬프트: 7420a4e54761출처열린 질문 (1)
독일어 가이드에서 번역됨gemini-3.8-flash-low · 2026-10-13 · 독일어 원문
스레드 경계를 넘어 파일 및 키-값 스토리지에 대한 스레드 안전한 접근을 가능하게 합니다.
템플릿 클래스 ara::per::SharedHandle은 스레드 경계를 넘는 스레드 안전한 접근을 제공하기 위해 파일 및 키-값 스토리지용 스마트 포인터 추상화 역할을 합니다. 팩토리 함수를 통해 획득한 후에는 핸들의 유효성 상태를 operator bool()[SWS_PER_00398]을 통해 확인해야 합니다. 비어 있거나 이동 연산으로 인해 무효화된 핸들에서 다른 연산자를 호출하면 정의되지 않은 동작이 발생하기 때문입니다. 캡슐화된 객체에 대한 역참조는 스레드 안전하지만, 동일한 인스턴스에 대한 핸들 [SWS_PER_00568]의 할당 및 소멸은 외부 동기화가 필요합니다.
컨텍스트
템플릿 클래스 ara::per::SharedHandle은 AUTOSAR Adaptive Platform의 per (Persistency) 모듈에서 영구 스토리지 리소스를 위한 스마트 포인터 추상화를 나타냅니다. 이 클래스는 팩토리 함수 OpenFileStorage() 및 OpenKeyValueStorage()의 표준화된 반환 타입 역할을 합니다. 클래스의 주요 책임은 스레드 경계를 넘어 파일 및 키-값 스토리지에 대한 접근을 조정하고, 스토리지 오픈 및 접근 루틴의 스레드 안전한 구현을 가능하게 하는 데 필요한 캡슐화를 제공하는 것입니다. 상호작용 파트너는 애플리케이션 측 스레드, 영속성 관리 및 각각 캡슐화된 스토리지 리소스 T입니다.
수명 주기
SharedHandle은 일반적으로 per의 팩토리 인터페이스를 통해 스토리지 인스턴스를 열 때 생성됩니다. 복사 생성자 [SWS_PER_00369] 및 복사 대입 연산자 [SWS_PER_00370]을 통해 핸들을 복제할 수 있으며, 이를 통해 여러 핸들 인스턴스가 동일한 대상 객체에 대한 공유 접근 권한을 얻습니다. 이동 생성자 [SWS_PER_00367] 또는 이동 대입 [SWS_PER_00368]을 통해 핸들이 전달되면 소스 핸들은 무효화된 상태로 전환되며 더 이상 스토리지 접근에 사용할 수 없습니다.
명시적 변환 연산자 operator bool()[SWS_PER_00398]은 핸들의 현재 상태를 확인합니다. 유효한 스토리지 인스턴스를 참조하는 경우 true을 반환하고, 핸들이 비어 있는 경우 false을 반환합니다. 핸들 리소스의 해제는 소멸자 ~SharedHandle()[SWS_PER_00568]을 통해 수행됩니다. 해석: 기본 스토리지 리소스는 마지막으로 참조하는 SharedHandle이 소멸되는 즉시 해제될 것으로 추정됩니다. 질문 Q-00a1798cf43e0ee6 (열림)
치명적인 오류 상태는 주로 비어 있거나 무효화된 핸들에 대한 잘못된 연산에서 발생합니다. [SWS_PER_00398]에 따르면 비어 있는 핸들에서 operator bool() 이외의 어떠한 연산자를 호출하더라도 즉시 정의되지 않은 동작(Undefined Behavior)이 발생합니다. 이는 특히 이동 생성 [SWS_PER_00367] 또는 이동 대입 [SWS_PER_00368] 이후의 소스 핸들에 해당하는데, 해당 핸들이 무효화되어 더 이상 사용할 수 없기 때문입니다.
Move constructor for SharedHandle. The source handle object is invalidated and cannot be used anymore. The operator bool() shall be used to check the state of a handle object before using any other operators of the handle object.
Move assignment operator for SharedHandle. The source handle object is invalidated and cannot be used anymore. The operator bool() shall be used to check the state of a handle object before using any other operators of the handle object.
Handle state. True if the handle represents a valid object of the templated class, False if the handle is empty (e.g. after a move operation). Using other operators than bool() of an empty handle will result in undefined behavior.
Move constructor for SharedHandle. The source handle object is invalidated and cannot be used anymore. The operator bool() shall be used to check the state of a handle object before using any other operators of the handle object.
Move assignment operator for SharedHandle. The source handle object is invalidated and cannot be used anymore. The operator bool() shall be used to check the state of a handle object before using any other operators of the handle object.
Handle state. True if the handle represents a valid object of the templated class, False if the handle is empty (e.g. after a move operation). Using other operators than bool() of an empty handle will result in undefined behavior.
gemini-3.8-flash-low· 2026-10-13 · 독일어 원문