Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
4
Newest
 Editor
Impact
~2k people reached

  • 0 posts edited
  • 0 helpful flags
  • 9 votes cast
Oct
29
revised Is it a good idea to make method behavior depend on the calling thread?
deleted 53 characters in body
Oct
29
comment Is it a good idea to make method behavior depend on the calling thread?
Thanks for the comments! I didn't know of SynchronizedStream, so that was good to hear of. To clarify - I didn't want to clutter the question but the real problem requires slightly more than multiplexing (its something more along the lines of a cache, so the threads don't know they are sharing a stream - and in fact they aren't - they are sharing a block of memory written to by another thread which does own the stream). Writes are therefore not an issue, but the Position state is, since it can't be multiplexed.
Oct
29
accepted Is it a good idea to make method behavior depend on the calling thread?
Oct
29
comment Is it a good idea to make method behavior depend on the calling thread?
All these answers have been great! Unfortunately I am not in .NET 4.5 for this project, so cannot use ThreadLocal<>, however I am glad to see that thread-specific functionality is considered an acceptable pattern, enough to be explicitly supported by .NET, and this is the approach I will take in the future. On reflection I agree with everyone here that explicitness for future maintainers trumps cleanliness. Where specific types like ThreadLocal<> are available I will prefer that, where they aren't, I will, and have, implemented a non-threadsafe 'view' class into a thread-safe object.
Oct
29
revised Is it a good idea to make method behavior depend on the calling thread?
added 122 characters in body
Oct
26
asked Is it a good idea to make method behavior depend on the calling thread?
Dec
22
comment What is the best way to compose an object with components across two assemblies?
@Telastyn, svick, Ed, Thanks for your comments - I have gone away and thought about this question and rewritten it as I think it was pretty poor before - Telastyn probably explained the problem better in the answer than I did! Hopefully it is much clearer what I am trying to accomplish now.
Dec
22
revised What is the best way to compose an object with components across two assemblies?
added 11 characters in body; edited title
Nov
26
comment What is the best way to compose an object with components across two assemblies?
(I should say, if this sounds like premature optimisation, there was another section of my code that did originally use lookups, but they were re-factored out when it became the source of performance problems, so I do have some reason for it ;))
Nov
26
comment What is the best way to compose an object with components across two assemblies?
@Telastyn, I have added more detail, and rephrased that section to express my concerns more accurately - its not so much that the dictionary is 'slow', its that is slow in comparison to a 'direct reference' in a section of code which is very time sensitive.
Nov
26
awarded  Editor
Nov
26
revised What is the best way to compose an object with components across two assemblies?
added 208 characters in body
Nov
26
asked What is the best way to compose an object with components across two assemblies?
Jun
3
asked An alternative to multiple inheritance when creating an abstraction layer?
May
12
comment What is the algorithm to copy a region of one bitmap, into a region in another?
@James, yes, that does just what I was trying to describe. Although the Windows implementation takes HDCs so I can't use it directly, it is very helpful reading about it.
May
12
awarded  Scholar
May
12
accepted What is the algorithm to copy a region of one bitmap, into a region in another?
May
12
comment What is the algorithm to copy a region of one bitmap, into a region in another?
Thank you - this is what I wanted - the principles behind the code to sample/transform and interpolation/sampling methods; I have implemented my method and the scaling/stretching is working perfectly.
May
10
awarded  Student
May
10
asked What is the algorithm to copy a region of one bitmap, into a region in another?