Tagged Questions
2
votes
4answers
151 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 ...
0
votes
3answers
64 views
How to correctly get a IDisposeable when you need to lock the factory?
If I need to create a IDisposeable object from a factory, but if the factory object is not thread safe and requires me to lock on it is this the correct pattern to use?
public void ...
4
votes
2answers
114 views
Getting a decryptor object
I need to lock on my AesManaged instance _Aes to call CreateDecryptor() however the CreateDecryptor() method is not thread safe and this function could be called by multiple threads. Is this the ...
1
vote
2answers
358 views
Multithreading concepts with Producer Consumer
I just wanted to confirm if this example I created would qualify as a good example of a multithreaded producer consumer. I would like any review changes on improving this example. I found that static ...
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, ...
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 ...
1
vote
1answer
465 views
ReentrantLock with priorities for waiting threads
I am trying to have a ReentrantLock with another way to determinate which thread will have the lock in the waiting queue. ReentrantLock implementation manages a Fair/Unfair policy, that's not what I ...
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 ...
1
vote
1answer
223 views
Read-write lock implementation for Ruby, new version
I recently discovered that there is no free read-write lock implementation for Ruby available on the Internet, so I built one myself. The intention is to keep it posted on GitHub indefinitely for the ...
11
votes
2answers
450 views
Lock-free cache oblivious n-body algorithm
I'm currently looking at, from a rather high level, the parallelization of the gravity calculation in an N-body simulation for approximating a solution to the N-body problem.
The simple form of the ...
4
votes
0answers
924 views
“Fast” Read/Write Lock
I need a Read-Write lock that is fast and generally portable on Windows machines (including XP, otherwise I'd just use the SRWLock that was introduced with Vista). I've written this custom ...
3
votes
2answers
83 views
Review a newbie's pthread code
I'm a pthread newbie and I've been giving myself a challenge: I want to have a resource that multiple threads can access at the same time as read. However, if a thread wants to write, then this need ...
3
votes
1answer
275 views
Single word CAS tagged pointer for algorithms susceptible to the ABA problem
I've been looking for a solution to the ABA problem for a lock-free stack. Searching the Web revealed patented and complicated hazard pointers and tagged pointers using double compare-and-swap (DCAS, ...
5
votes
4answers
560 views
Associating a lock/mutex with the data it protects
I've recently come across some areas of code in our solution that have a few thread-safety problems. Thread-safety is a minefield at best so I thought I'd have an attempt at writing a few little ...
4
votes
1answer
1k views
C++ critical section with timeout
NOTE: My implementation is based on codeproject article by Vladislav Gelfer.
Based on valdok's codes, I rewrote the critical section class. The difference is that my implementation integrated ...