All Questions
Tagged with concurrency multithreading
6,660
questions
-1
votes
0
answers
43
views
How to process a (near) infinite list in Java?
I am using an object storage provider that does not implement a recursive delete. When someone comes in and asks to delete a bucket, I have to manually empty the bucket. I basically have two methods ...
1
vote
1
answer
88
views
Java concurrency problem by multi-thread not occured and automatically synchronized
I’m trying to test a multi-threaded concurrency problem.
What I expected is that the result should be less than 0 (not always but sometimes), because it is not synchronized.
Notice the pair of println ...
-1
votes
1
answer
50
views
Using AtomicInteger as counter for List [closed]
I am learning multi threading. I have below code which implements round robin algorithm over an CopyOnWriteArrayList. List will always have a fixed number of elements let's suppose 10.
...
1
vote
1
answer
42
views
Java CopyOnWriteArrayList add element if not exists already
I have an CopyOnWriteArrayList as my code should be thread safe.
List friuts = new CopyOnWriteArrayList<>();
I don't want to have duplicate friuts in list I cannot use Set as I want to have ...
1
vote
1
answer
73
views
Multithreaded program not running as expected
I was trying to learn about semaphores, reading The Little Book of Semaphores by Allen B. Downey.
In that there is a puzzle:
Generalize the rendezvous solution. Every thread should run the
following ...
0
votes
0
answers
20
views
Multiple producer single consumer queue usecase
I am relatively new to Python and this is the usecase i am trying to solve as part of the learning.
There will be multiple threads calling a callback function. If the event is not set, the callbacks ...
0
votes
1
answer
62
views
Guarding tests against exit/death
I'm using googletest to test multi-threading code with std::thread. In broken code, it often happens that a std::thread is destroyed before the thread has joined, causing a program termination. ...
0
votes
0
answers
40
views
Concurrency and Multi-threading
How can one implement a custom ReadWriteLock in Java that allows a thread to upgrade a read lock to a write lock without risking deadlock?
0
votes
1
answer
124
views
Is this ThreadPool implementation correct?
I am new to concurrent coding and trying to implement simple ThreadPool by myself. I found this implementation on a learning website(jenkov.com) and it seems to be working fine.
However, I think ...
0
votes
2
answers
78
views
Testing concurrency of a collection with XUnit provides different results
I have a concurrent class called ClientManager that uses a hashset and a ReadWriterLock to register my "clients" through their Guid:
internal class ClientManager : IClientManager
{
...
0
votes
1
answer
73
views
How can I formally verify the correctness of my WaitGroup implementation in C++?
Description
I've implemented a WaitGroup in C++ assuming that:
user must ensure that the counter value does not drop below zero.
WaitGroup can be reused.
Below is my code:
class WaitGroup {
public:
...
1
vote
1
answer
63
views
call swift Actor from AVAudioEngine (synchronous) code
I'm using apple's AVAudioEngine code like this:
var audioEngine = AVAudioEngine()
audioEngine.inputNode.installTap { [buffer, when] in
let waveform = myGetWaveform(buffer)
Task {
await ...
0
votes
0
answers
23
views
Is a class considered thread safe if it throws an exception on concurrent access?
Ideally we expect to be able to safely call methods on a thread safe class from multiple threads expecting an output as if the methods had been serialized in some order. If I have a class that throws ...
0
votes
0
answers
60
views
How to Fix Race Conditions When Atomically Updating BigDecimal in Kotlin
I’m facing a race condition issue when trying to atomically update a BigDecimal value in Kotlin. Here’s a minimal example:
import java.math.BigDecimal
data class Account(
var totalBalance: ...
1
vote
1
answer
72
views
Concurrency safety during frame updates in Swift
I have a method named render that's called on every frame to draw something on screen using Metal. It is rendering some array of points stored inside the class. However, I occasionally need to update ...