141,057 questions
0
votes
2
answers
102
views
How to infer whether a global sequence is valid or not with std::memory_order_seq_cst?
#include <atomic>
#include <thread>
#include <cassert>
#include <chrono>
std::atomic<int> x {}, y {};
void write_x_and_y() {
x.store(1, std::memory_order_seq_cst); ...
4
votes
1
answer
136
views
std::terminate is called due to uncaught exception inside of joined thread
I am wondering why exceptions inside joined thread invoke std::terminate and detached threads do not invoke std::terminate.
Consider following snippet that triggers std::terminate. If we replace t2....
1
vote
1
answer
99
views
How to pause a thread from the outside? [closed]
On macOS, with Swift, is there any way to suspend and resume threads from the outside? I want to make sort of a manager of tasks. You can launch tasks (every task is a function running in a separate ...
1
vote
0
answers
126
views
IllegalThreadStateException in Spark 4.0 when Adaptive Query Execution (AQE) is active and when running many queries in the same Spark instance
Upon upgrading to Spark 4, we get (deterministically) an IllegalThreadStateException in long series of queries including spark.ml or Delta Lake (e.g. in estimator.fit()) in the same long-running Spark ...
2
votes
1
answer
80
views
StatelessKieSession doesn't appear thread safe
I'm trying to optimize a section of the app by switching the single processing of a collection into running parallel under a lambda function.
I am building my KieContainer once as follows:
/**
* From ...
0
votes
1
answer
38
views
Deadlock in mixing Wait and WaitAsync
In our code we have seen a deadlock when using both the Wait and WaitAsync variant of the SemaphoreSlim. The class "Adder" below is a slimmed down version of what we have in our code:
class ...
0
votes
0
answers
98
views
JavaFX Concurrency: Objects "changing" type
I'm creating an implementation of Minesweeper using JavaFX. Here, I have some code that runs in another thread and updates the GUI with the state of the game. It loops thru all the cells on the board ...
4
votes
1
answer
101
views
When exactly does a robust POSIX mutex that returns EOWNERDEAD get locked?
I know that, for POSIX shared and robust mutexes, if the process holding them crashes, the next process trying to acquire the lock will successfully call pthread_mutex_lock, which will return ...
0
votes
1
answer
185
views
Is reflection thread safe in C#? [closed]
Can I access PropertyInfo from the same System.Type from multiple threads?
Can I call the same PropertyInfo.GetValue on different objects from multiple threads?
-2
votes
1
answer
132
views
Assign thread object after the join function in C++
As per my understanding it is fine to assign the thread object and call join function in C++ 11.
eg as below :
#include <iostream>
#include <thread>
using namespace std;
void func()
{
...
1
vote
0
answers
29
views
Intercepting worker thread in smallrye incoming channel
We are using Quarkus 3.15.3.1, Java 21 and JSONata4Java version 2.5.1. We want to optimize JSONata usage, so we prepare expressions for JSONata transformations like this
Map<String, Expressions> ...
0
votes
0
answers
109
views
Implementing lock-free remove for hashmap
I'm trying to implement a lock-free hashmap in C.(It doesn't actually free the elements when removing, I'm letting memory leak until it's destroyed). A node contains value, next ptr, and char array ...
0
votes
0
answers
113
views
Weird behavior with Ruby memoization pattern and thread safety in Rails 7
I'm working on a Rails 7 app where we're using the classic ||= memoization pattern in a service object that handles some complex reporting logic. We've started seeing some bizarre race conditions in ...
2
votes
2
answers
363
views
How to create individual rich progress bars for each worker in Python multiprocessing's imap_unordered()?
I have a simple code that you can run (the logging is to differentiate 4 workers):
import time
import random
import logging
import logging.handlers
from multiprocessing.dummy import Pool
def ...
4
votes
3
answers
236
views
Why do we need condition variables when we can use two semaphores?
An example of producer and consumer threads is usually given.
But this can be done with two semaphores.
Why do we need condition variables then?
Example with pthread library:
// write thread
while(1)
{...
0
votes
1
answer
56
views
Tkinter threading with music
I have added a music button to my Tkinter GUI, when I press it, it plays music but the other aspects wont work such as clicking other buttons and moving the window, I have tried threading but still no ...
0
votes
0
answers
105
views
How is a multithreaded code (ex using OpenMP) converted to assembly?
For example, When I multithread a "for loop" using OpenMP, making the iterations as different threads, How does it get translated to Assembly?
Also can a multithreaded code run on hardware ...
1
vote
1
answer
127
views
Spring skip overlapping task in Scheduled cron by default. How can I pospone the task instead?
I have following job in spring boot application:
@Scheduled(cron = "0/5 * * * * *")
fun processDocumentsBatch() {
log.info("job has started")
Thread.sleep(7000)
log....
2
votes
2
answers
194
views
Is std::binary_semaphore release() guaranteed to finish earlier than acquire()?
Let's say I have following class
class MyClass
{
std::binary_semaphore sem{0};
std::binary_semaphore& sem(); // just returns the semaphore
// some other members
}
And I have some global ...
2
votes
0
answers
83
views
Why is training multiple deep learning models (via multiple terminals) faster than training a single model? Is it because higher clock speeds?
I'm training deep learning models using TensorFlow (with GPU support) on my local machine. I noticed a surprising behavior:
When I train just one model (in a single terminal), it runs slower.
But ...
5
votes
1
answer
166
views
std::reduce with std::execution::par seems to do nothing
I'm encountering an issue where my program is faster than std::reduce with std::execution::par enabled. I highly doubt that my code is more optimized, especially considering the fact that I am using ...
2
votes
3
answers
221
views
Is std::map::operator[] thread-safe if it doesn't insert?
We insert some keys into a std::map in a single thread.
Then in multiple threads, we get values using operator[] for some keys; these keys are guaranteed to have been inserted in the first step. (No ...
0
votes
1
answer
120
views
How to safely share updated market data (struct of doubles) between producer and consumers threads without locks?
I have a multi-threaded application where one producer thread updates market data for multiple instruments, and multiple consumer threads read this data to compute spot prices based on strategies like ...
0
votes
2
answers
148
views
Does std::async internally make use of std::jthread or std::thread?
I know std::jthread got introduced in C++20. And also std::async which got introduced in C++11 which as per my knowledge internally makes use of C++11 std::thread. So I want to know, has std::async ...
1
vote
2
answers
165
views
Does calling member function access the memory location of the object in C++?
Let's say i have following classes
class MyClass
{
private:
std::string data_;
public:
MyClass(const std::string& data) : data_(data) {}
void func()
{
...