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().
थ्रेड सीमाओं के पार फ़ाइल और कुंजी-मान स्टोरेज तक थ्रेड-सुरक्षित पहुंच सक्षम करता है।
एआई-जनितअसत्यापितमॉडल: 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 · जर्मन मूल