1
vote
4answers
127 views

Simple multi-threading class: Does anybody spot potential lock-based concurrency issues?

Trying to write a multi-threaded utility that logs some audit trails to the DB every 30 minutes, or whenever my storage data structure (a list in this case) exceeds a certain limit. The code works ...
1
vote
0answers
59 views

Reusing thread and UdpClient for sending and receiving on same port

The working and functional code below is a simplification of a real test application I've written. It acts as a client which asynchronously sends UDP data from a local endpoint and listens for an ...
1
vote
2answers
96 views

Correct way to delete elements from a ConcurrentDictionary with a predicate

I have written a caching wrapper class for ConcurrentDictionary. Basically it has a timer that checks if items are expired and removes them. Since ConcurrentDictionary does not have RemoveAll method ...
0
votes
1answer
52 views

Does refactoring a while loop increase CPU usage

While upgrading our code base to take advantage of new features in .Net 4.5, I'm trying to refactor our take of the classic Producer/Consumer algorithm, but I'm concerned my refactoring is going to ...
1
vote
1answer
128 views

creating dynamic threads

First, I want to say that this code works, but I want to make sure this is the right way of doing it. I am writing this for a SMS text API that loops through each phone number. I sometimes gets hung ...
0
votes
1answer
132 views

Asynchronous version of AutoResetEvent

This is my second attempt to create asynchronous version of AutoResetEvent. At first I tried to make it completely lock-less, but it turned out to be impossible. This implementation contains a lock ...
3
votes
2answers
170 views

Improving UI response times by threading, a better way?

Since I've started to use a computer, I hated everytime an application's UI stops responding for a while. However, there are some applications I see, that are doing their "heavy" jobs, yet the UI ...
3
votes
2answers
167 views

Please review my UNC path exists monitor

This is my first attempt at trying to write a "monitor" class to determine if a UNC path is available. I need the monitor to not block the main thread and to also event when the UNC is toggled UP/DOWN ...
4
votes
6answers
471 views

Strategy for avoiding threadpool starvation while performing cpu bound jobs in a queued fashion

My aim is to avoid using threadpool threads for CPU bound work, thus avoiding a situation where IIS stops responding to new requests. Can you see any problems with the code below? Is this a ...
1
vote
3answers
398 views

WPF Application high CPU usage with threads [closed]

I've spent the last few hours trying to debug my application, it seems like its using much more CPU than it should. I believe this is a problem with my lack of understanding on how to properly use ...
3
votes
1answer
354 views

.Net caching service - thread safety

I have a simple cache service that i am using inside my WPF prism application, i am concerned about the thread safety of it - we will be accessing this via multiple threads and using the current code ...
0
votes
0answers
56 views

Managing thread's priority manually

The scenario is as follows: There are a couple of low priority threads that can be interrupted by high priority threads. Whenever a high priority thread asks the low priority threads to pause, they ...
5
votes
2answers
196 views

Using different instances of an object to lock threads

I'd like to use lock objects that are specific to the person I'm updating. In other words, if thread A is updating Person 1, thread B is blocked from also updating Person 1, but thread C is not ...
2
votes
0answers
489 views

Analysis this Producer/Consumer queue for potential threading issues

I use this class for scheduling bits of work on a single thread. Work can be scheduled to be executed immediately or at a future time with the use of timers. It has many producers (the work adders) ...
2
votes
1answer
122 views

Quickly updating a mass of objects

int X = 1; int Y = 0; while (X != 99 - 1 || Y != 99 - 1) { Y++; if (Y > 99 - 1) { X += 1; Y = 1; } Layer1ID[X, Y].Update(X, Y); Layer2ID[X, Y].Update(X, Y); ...

1 2
15 30 50 per page