• CSyncCollection的目的是要MFC类,作为一个templatized收集它实现了线同步与超时都添加和去除。

    一般来说,为了避免竞争条件和僵局,这是必要的,同步访问,通过多线程的共享资源。 而且,前述的同步,也可以有助于确保独立代码是执行适当的顺序。

    这个同步的是确保由各种对象的工作的同时,即事件、计时器、线、进程、信号灯互斥或和控制台输入缓冲区,仅仅举几例。 该问题时,可能会发生操纵他们的是,当你指定一个处理任何的他们在叫到一个等待功能,执行该线被阻止,直到国家的对象变为发出信号。

    由于这个templatized集合,可以使用的添加功能,同时指定一个超时以等待的突发事件的集合是充分的。 当雇用的去除功能的数据收集,你可以再一次指定的超时如果收集是空的。

    所有的一切,使得这类templatized意味着你可以存储的任何类型的数据你想要的。 此外模板,用于各种定义收集的类型。 代码来与预定的模板为一堆和排队集合它依赖于STL容器。

  • के CSyncCollection डिजाइन किया गया था होना करने के लिए एक MFC वर्ग है जो कार्य करता है कि के रूप में एक templatized संग्रह को लागू करता है जो धागा तुल्यकालन के साथ समय समाप्ति के लिए दोनों को जोड़ने और हटाने.

    आम तौर पर बोल से बचने के लिए, दौड़ की स्थिति और deadlocks, यह आवश्यक है करने के लिए सिंक्रनाइज़ के द्वारा उपयोग करने के लिए कई सूत्र का साझा संसाधन है. इसके अलावा, ऊपर उल्लिखित तुल्यकालन भी सहायक हो सकता है कि यह सुनिश्चित करने के लिए स्वतंत्र कोड मार डाला है उचित क्रम में.

    इस तुल्यकालन द्वारा सुनिश्चित किया जाता है विभिन्न वस्तुओं का काम करने के साथ-साथ, अर्थात् घटनाओं, टाइमर, धागे, प्रक्रियाओं, semaphores, mutexes या और सांत्वना इनपुट बफ़र्स, बस कुछ ही नाम के लिए. समस्या है कि हो सकता है जब उन्हें जोड़ तोड़ है कि जब आप निर्दिष्ट करने के लिए संभाल में उनमें से किसी के लिए एक कॉल के लिए प्रतीक्षा करें, कार्यों के निष्पादन धागा अवरुद्ध है जब तक राज्य की वस्तुओं बन जाता है संकेत.

    इस के लिए धन्यवाद templatized संग्रह का उपयोग कर सकते हैं जोड़ने के समारोह को निर्दिष्ट करने के लिए एक मध्यांतर के लिए प्रतीक्षा करने के इमकान है कि संग्रह से भरा है । जब रोजगार के समारोह को हटाने के लिए डेटा संग्रह में, आप फिर से कर सकते हैं निर्दिष्ट मध्यांतर यदि संग्रह खाली है ।

    सब सब में, बनाने वर्ग templatized मतलब है कि आप स्टोर कर सकते हैं डेटा के किसी भी प्रकार आप चाहते हैं पर है । इसके अलावा टेम्पलेट्स इस्तेमाल कर रहे हैं परिभाषित करने के लिए संग्रह विभिन्न प्रकार के । कोड के साथ आता है पूर्वनिर्धारित टेम्पलेट्स दोनों के लिए एक ढेर और कतार के संग्रह और उस पर निर्भर करता है एसटीएल कंटेनर.

  • The CSyncCollection was designed to be an MFC class which that acts as a templatized collection which implements thread synchronisation with timeouts for both adding and removing.

    Generally speaking, in order to avoid race conditions and deadlocks, it is necessary to synchronize the access by multiple threads to the shared resources. Moreover, the aforementioned synchronization can also be helpful to ensure that the independent code is executed in the proper sequence.

    This synchronization is ensured by various objects working simultaneously, namely events, timers, threads, processes, semaphores, mutexes or and console input buffers, just to name a few. The problem that can occur when manipulating them is that when you specify a handle to any of them in a call to one of the wait functions, the execution of the thread is blocked until the state of the objects becomes signaled.

    Thanks to this templatized collection, you can use the Add function while specifying a timeout to wait for in the eventuality that the collection is full. When employing the Remove function for the data in the collection, you can again specify the timeout if the collection is empty.

    All in all, making the class templatized means that you can store any type of data you want on in it. In addition templates are used to define various collection types. The code comes with predefined templates for both a stack and queue collection and it relies on STL containers.