Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Use this tag when the program performs its work using multiple concurrent threads of execution.
1
vote
Accepted
Implementation of ordered lock pattern
I haven't extensively tested it, but there are a few things I've noted:
The class has two members which hold on to IDisposable resources. Therefore, the class must implement IDisposable as well and D …
4
votes
Concurrent blocking Tasks in a BackgroundWorker
I would make your lock a little more tight:
lock (ret)
{
ret.AddRange(result);
}
But otherwise, looks like an all right implementation.
1
vote
ThreadSafeKeyedObservableCollection<TKey, TItem>
There are a couple of issues with regards to being thread-safe:
1:
public IEnumerable<TKey> Keys()
{
return _dict.Keys.ToList();
}
public TItem TryFindByKey(TKey key, out bool result)
{
if …
0
votes
Generate consecutive sentence of int values accessed from different threads
Never lock on this as your callers can also do the same and cause deadlocks where you don't expect them. See below where I create and use a private locking variable. And made i an instance variable si …
1
vote
Action queue in .NET 3.5
Don't expose your concrete lists:
public class ActionQueue
{
private readonly IList<Action> actions = new List<Action>();
public IEnumerable<Action> Actions
{
get
{
…
3
votes
Optimizing a Fire and Forget page tracker
Looks sharp to me. I'd do a little bit of declarative intent:
public static class Logger
{
private static readonly string _conn = ConfigurationManager.AppSettings["MyDatabase"];
private const …
4
votes
Accepted
Getting a decryptor object
I would say you're not using AES correctly - don't hold on to an instance of it in your class (guessing by the underscore in the name) but rather create it as needed, while holding AES's parameters (t …
0
votes
Code works but memory usage is erratic
Here's how I would go about it (mostly from a readability standpoint rather than a performance one - though the use of immutable data may help contribute to well-measurable performance and memory usag …
4
votes
Accepted
Multithreaded item-processing queue
Yes, and don't lock on typeof - highly unrecommended. Also you'll need to lock whatever's adding to the QUEUE so that the multithreaded Dequeue() does not race against it.
static protected void Threa …