Hi, I'm just feeling out whether this is a worthwhile thing to pursue. How big is the datastructure that a ReaderWriterGate implements? I'm considering...
Each ReaderWriterGate object has a 4-byte enum, Another 4-byte integer representing the number of readers, a reference to two Queue<T>s (one for readers & one...
... I'll dig in and if I can make sense of it. ... If it is single threaded, can I have more than one instance of it inside the same .net assembly? I've got...
Can you have multiple instances of what? Your collection? Of course. Any of the types mentioned (ReaderWriterGate, OrderedBag, Dictionary)? Again, of course,...
"COM supports single-, multi-, and free-threaded apartments which all treat data with different characteristics. You should really understand what COM ...
Is it possible to set the affinity of an STA threaded COM component? Will the combination of the CLR + the OS be sensible on this? I haven't been able to find...
I don't know what you'd want to affinitize the COM STA thread. Normally, I'd recommend leaving this alone and let the OS schedule the thread as it sees fit. ...
"And actually, there is a 1-to-1 relationship between OS threads and .NET threads." thanks for the clarification. I was reading a lot of noise around that. ...
On Tue, Apr 17, 2012 at 9:18 PM, Jeffrey Richter ... Or you can use NuGet: http://nuget.org/packages/PowerThreading. ;) -- Jiri {x2} Cincura (x2develop.com...
Hi, I found the idea of passing and casting state in a callback to be more verbose than I'd like for my use case. Is this closure idea a valid approach, or...
I guess this overload answers the first question in terms of boiling the code down a bit further... m_gate.BeginRead((rel) => { // do stuff based on local...
Hi, I think I've answered this one as I wrote the email... so if you've got a pool of resources (normally 8 items) that belong to a single parent (1000s of...
The closure is definitely a valid approach. It does allocation more memory so it has more overhead than passing/casting but many people (including me) will use...
Yes, I forgot about that overload, so you can even do this: }, m_gate.EndRead); AsyncState is NOT about debugging; it is about passing data from one thread to...
This is a tricky one. If you occasionally need to atomically manipulate all parents together, then you always need to obtain a gate on all parents. So, if you...
Thanks very much for the reply... I'm thinking about using this scheme for the n portion of the idea when using ReaderWriterGate... given a list of identities...
Yes, this should work. I've not seen so many levels before but I've seen this kind of thing before. -- Jeffrey Richter (http://Wintellect.com/) From:...
Not sure what type(s) of resources you're trying to protect, but any chance you could make thread safe without locks? Immutable objects, user mode techniques? ...
... yes... but only if you shut everything down and do update runs (or exclusive lock and an entire structure). That is for many scenarios... but once you are...
Hi, I just wondered if someone could take a quick look at this code and let me know why this "delegateAccumulator" isn't executing as expected. It's my first...
If you haven't done so, I'd suggest reading the threading chapters in my CLR via C# book as it answers these kind of questions in great detail. The short...
I would add to these reasons, another Jeffrey brings to light in his book, that aside from all that wasted memory you have set yourself up for some serious...
On Mon, Apr 23, 2012 at 4:34 PM, Jeffrey Richter ... And to make things worse, the memory is committed. -- Jiri {x2} Cincura (x2develop.com founder) ...
Hi Steven, delegateAccumulator = () => { return new ReaderWriterGateCallback(releaser => f2.Invoke(null)); }; That statement in the foreach loop redefines...