Questions tagged [thread-safety]
A piece of code is thread-safe if it only manipulates data structures in a way that allows consistent execution of this code by multiple threads. A code may be thread safe, conditionally safe (mutual exclusion required) or unsafe (can only be safely used by one thread).
thread-safety
9,475
questions
-3
votes
0
answers
42
views
How to break from the Loop while listening from the Socket TCP connection in C++ QT form the different main thread
I have a main thread which starts the worker thread. This worker thread has a while(true) loop with a break statement and condition inside the loop.
This worker thread listens to the Socket connection ...
0
votes
0
answers
34
views
Connection settings being overwritten
A service (windows service) is used to create multiple threads and execute the different areas each thread is responsible for. For two specific threads the connection string and settings seems to be ...
1
vote
1
answer
62
views
Assigning value is atomic/thread safe?
using ConsoleApp1;
using System.Diagnostics;
using System.Numerics;
Console.WriteLine("Hello, World!");
Vector3 v1;
int n = 1000000000;
var t1 = new System.Threading.Thread(new ...
0
votes
0
answers
34
views
Is VSTest's Logger::WriteMessage not thread-safe?
I am seeing unexplained test failures when using Visual Studio 2022's VSTest's Logger::WriteMessage from multiple threads. In normal runs, I see
Test Run Successful.
Total tests: 26
Passed: 26
...
0
votes
1
answer
73
views
How do I return the response when working with multiple threads in Python?
How do I get a response when I call
response = gemini_pdf(message)
I want response to contain the final output. I’m stuck here.
Here is my code:
def read_pdf(file_path):
global file_content
...
-1
votes
0
answers
78
views
Capture of 'self' with non-sendable type 'Type?' in a `@Sendable` closure
I have a warnings 'Capture of 'self' with non-sendable type 'Type?' in a @Sendable closure' for this code
func launchPairingAtCorrectStepAfter(timeout: TimeInterval) {
Timer.scheduledTimer(...
0
votes
0
answers
18
views
Nlog with derived CustomizedTarget, Write to CustomizedTarget called in same thread as logger.Error
I derived LimitedFrequencyEmailTarget from NLog MailTarget in my asp.net core application to stop send out email if there is too many email. When I tested it in visual studio, I found that the Write ...
0
votes
0
answers
26
views
WaitHoldingLocks Exception
[libart.so] art::ConditionVariable::WaitHoldingLocks
ANR triggered by thread waiting for a binder transaction
*emphasized text* "main" tid=1 Native
#00 pc 0x0000000000099ccc /apex/...
0
votes
2
answers
96
views
Delphi iTask generates out of memory error at random times
I have to process an specific code in 5 different intervals. Each code is very similar differing just some parameters from each other. To accomplish this job I created an array of iTask where the ...
2
votes
1
answer
132
views
How to access a static property Swift 6 concurrency-safe?
My app uses a class A and its subclasses SubA_x.
A has a static property serialNumber that is only modified by class A when a subclass is initialized.
It sets a property let name so that every ...
0
votes
0
answers
73
views
Thread safety with std::vector (accessing and modifying different vector items with different threads)
I'm new in the world of parallel computing and doing many researches in data races and how to avoid those. The concept is quite clear to me, but I would have a question regarding the use of std::...
0
votes
1
answer
35
views
c# how to set ToolStripStatusLabel text in a thread safe way
I have a thread that pings various devices, the thread uses events when a ping is completed or times out.
In a form I have a handler that is connected to one of the events from the pinging thread, in ...
0
votes
1
answer
23
views
Is the partition method of a custom Partitioner implementation required to be thread-safe in Apache Flink?
I am implementing a custom partitioner by extending the org.apache.flink.api.common.functions.Partitioner interface in Apache Flink. This requires me to override the partition method. My question is: ...
2
votes
2
answers
125
views
How do I make an array threadsafe in Java?
I am pretty new to multithreading and want to understand it better. I want to now how to make an array threadsafe in Java? Meaning I have several threads accessing and changing the data in the array ...
0
votes
0
answers
15
views
Singleton class with thread safety
I am working in a project where I have to show the progress of an asynchronous process. To get the progress, I am using a progress class:
from flask import jsonify
import threading
class Progress:
...