Autor Beitrag
winx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Di 11.12.07 11:13 
Hi,

ich möchte gernen meinen generischen Queue

ausblenden C#-Quelltext
1:
Queue<ProcessItem> m_CamQueue = ...					


per Synchronize thread-safe machen, bekomme das aber nich hin...

wie sieht denn da die Syntax aus, denn

ausblenden C#-Quelltext
1:
m_MarkQueue = new Queue<ProcessItem>.Synchronize					


gibt es nicht, wie bei Standardqueues:

ausblenden C#-Quelltext
1:
Queue q = Queue.Synchronized(new Queue());					


Dankeschön für den entscheidenden Hinweis :D

gruß,
winx
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Di 11.12.07 11:18 
Wenn die Queue das nicht von selbst kann, musst du wohl selbst für die Synchronisierung sorgen. Steht übrigens alles auch im SDK ;) ...
Zitat:
Default implementations of collections in System.Collections.Generic are not synchronized.

Enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.