Tagged Questions
10
votes
7answers
7k views
A custom thread-pool/queue class.
I wanted a class which executes any number of tasks but only a certain amount at the same time (e.g. to download various internet content and keep the overall download speed at a good level). The ...
5
votes
1answer
897 views
Refactoring a multi-threaded producer-consumer model
This is an architecture question for a multi-threaded program which is going to be moved from C# .NET 2 to .NET 4. The program currently has multiple processing threads, and one database I/O thread. ...
4
votes
2answers
1k views
Did I need to use lock to ensure that Queue.Dequeue is Thread Safe in this case on .NET 2.0?
Is this ok? I am using C# and .NET 2.0
I have this Queue declared in my class :
static private Queue<SignerDocument> QUEUE = new Queue<SignerDocument>();
I fill this Queue with some ...
4
votes
3answers
1k views
Java blocking queue
public class BQueue<T> {
private Queue<T> q = new LinkedList<T>();
private int limit;
public BQueue(int limit) {
this.limit = limit;
}
public ...
3
votes
4answers
559 views
Optimizing a thread safe Java NIO / Serialization / FIFO Queue
I've written a thread safe, persistent FIFO for Serializable items. The reason for reinventing the wheel is that we simply can't afford any third party dependencies in this project and want to keep ...
2
votes
5answers
709 views
Bounded blocking queue
Can someone please review this code for me. I have not implemented all the methods for simplicity.
Original code:
/**
* Implements a blocking bounded queue from a given non-blocking unbounded queue ...
2
votes
2answers
460 views
Robust logging solution to file on disk from multiple threads on serverside code
I have implemented a socket listener that runs on my Linux Ubuntu server accepting connections and then starting up a new thread to listen on those connections (classic socket listener approach). ...
2
votes
1answer
1k views
A simple thread-safe queue in python
I'm trying to implement a kind of message queue. Tasks will come in at unknown random times, and must be executed FIFO. I can do multiple tasks in one hit, but the setup and tear down unavoidably ...
1
vote
1answer
979 views
Simple generic multithreaded queue
This is a simple thread safe queue that is used in a producer-consumer model.
public class ThreadedQueue<TType>
{
private Queue<TType> _queue;
private object _queueLock;
...