1
vote
0answers
62 views

Generic Task Blocking Queue

A generic blocking queue has the following properties: It is thread-safe. It allows queuing and de-queuing of items of a certain type (T). If a de-queue operation is performed and the ...
1
vote
2answers
51 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 ...
2
votes
1answer
38 views

Proper way to cancel WebClient in BackgroundWorker

I have a WPF application that needs to get a XML document using a web request. The request is based on an id that the user enters. If the user enters a second id, before the first returns, I would ...
2
votes
1answer
37 views

Synchronization of remote files download

Preamble: it's a self-assigned and pure syntetic task to learn (and remember what I already knew) C# threads and synchronization and data structures. The original question was here ...
1
vote
0answers
55 views

Need guidance using Tasks

I am doing multithreading using TPL Tasks first time. This is what i have done so far and I want to do it the right way. I will really appreciate if you could honor me with your expert advice. I am ...
2
votes
1answer
65 views

Simple Freelock collection

I wrote simple lock-free collection class for saving items from multithreading code. I did it just for fun and experience. Can you check my code for potentially problems please? public class ...
0
votes
2answers
104 views

ThreadPool implementation

The following code is a self-implementation of the static class ThreadPool in C#, only the QueueUserWorkItem (the simpler method), written to practice multithreading in the .NET environment and ...
2
votes
0answers
37 views

Monkey testing a SmartCard library

My definition of monkey testing is basically playing with a program in as if I was a monkey (press every button, unplug things, go in the wrong order..etc etc) So I made a rather simple SmartCard ...
0
votes
1answer
94 views

Multi Threaded Error Logger

I am trying to design a class that will log errors to a text file, the application is using threads heavily so it may be that 2 errors that need to be written at the same time. I know there are 3rd ...
1
vote
1answer
93 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 ...
3
votes
1answer
72 views

Implementation of ordered lock pattern

Below is attempt to catch potential deadlocks at runtime in C#. Basically this class allows user to acquire locks in a pre-defined order only. I ran some basic tests and it appears to work. Please ...
1
vote
2answers
85 views

Multi-threaded Winforms Conventions for Main()

I'm trying to find a good pattern for new applications (and for refactoring old ones). Maybe it's just me, but I dislike spawning my main logic thread from inside my main form thread (so far I always ...
0
votes
1answer
101 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 ...
1
vote
1answer
180 views

Producer/Consumer with some limitations

The code realizes producer/consumer problem with multiple producers and consumers. Have this code any potential deadlock or races? //RandomDataProvider.cs namespace MyNamespace.Core { using ...
2
votes
4answers
163 views

Designing a better logger class

Could you please critisize the logger class below? Can it be used in a multi threaded web environment? If not how can I improve it? Is there anything wrong with locking in WriteToLog method or ...

1 2 3 4 5
15 30 50 per page