5
votes
0answers
74 views

Concurrency limit map in Go

Please someone who knows locks, mutexes, and Go, review the following code. Task: per host concurrency limits for web crawler (map[string]Semaphore). I considered chan struct{} (chan bool) approach, ...
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 ...
4
votes
2answers
869 views

thread-safe stl map accessor

So after learning that stl map containers are not inherently atomic and therefore not thread-safe (check out this related stackoverflow question and usage example), I decided to create code that would ...
3
votes
4answers
163 views

Configurable synchronization approach in Java

I am interested in the community opinion about the following approach for the synchronization. Generally it is based on the idea to have a configurable way to apply locking on some logic parts. Any ...
3
votes
2answers
54 views

Is this a scenario to use volatile instead of synchronized?

I want to know if using volatile in this scenario will give a better performance than using synchronization. Specifically for the paused and running instance variable in the SimulationManager class. ...
2
votes
1answer
230 views

What do you think about resource locker in Qt?

The idea is to lock resource, in c# or java way un Qt with code lock(obj){/*process with locked obj*/} No I see, the problem with deleting obj under lock. resourcelocker.h #ifndef RESOURCELOCKER_H ...
2
votes
2answers
106 views

Invoking a callback on a pool of threads

This class acts like a synchronization context except the work could be done on any one of the available threads. I've done quite a bit testing on my own, but I'm generally concerned about potential ...
1
vote
1answer
165 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 ...