9,553 questions
6
votes
0
answers
355
views
Delphi Linux TEvent.SetEvent thread safety
Under Delphi for Linux, TEvent.SetEvent() is implemented as follows:
procedure TEvent.SetEvent;
var
I: Integer;
begin
sem_getvalue(FEvent, I);
if I = 0 then
sem_post(FEvent);
end;
Although ...
5
votes
2
answers
157
views
Can the compiler choose memory ordering for atomic operations?
Recently, when working with C atomics, I've noticed that there are two variants: a "normal" version, whose order is always seq_cst, and an "explicit" version, where the programmer ...
Advice
0
votes
6
replies
139
views
How does .NET ensure memory safety of the compiler generated state machine for async/await?
I have a pretty good understanding of how async await works under the hood.
One thing I am curious about is what actually ensures the memory of the generated state machine is synchronized to the other ...
1
vote
1
answer
103
views
Swift 6 strict concurrency: How to achieve Sendable conformance for a class bridging C callbacks?
I'm working on a macOS app that uses Apple's private MultitouchSupport.framework to intercept raw trackpad touch data. The framework uses C-style callbacks that fire on an internal background thread (...
1
vote
1
answer
251
views
Is reading XML with LINQ-to-XML thread-safe?
By "thread-safe" I mean: If two threads simultaneously read from the same XDocument, will there be trouble?
By "read" I mean: The code uses only non-mutating operations, e.g. read ...
1
vote
0
answers
138
views
FastAPI and singleton boto3 service resource
Does FastAPI use new threads per request?
In my fastapi app, I have a global singleton class that uses boto3 to connect to s3 using a service resource. This class is inited at startup and is used ...
Advice
3
votes
8
replies
202
views
Is IMG_Load from SDL2/SDL_image thread safe
I want to use multiple threads to decode PNG files to speed up loading in my C++ game engine.
The easiest solution is to use IMG_Load from SDL_Image, as I already use SDL, e.g.:
surface = IMG_Load(...
1
vote
2
answers
138
views
Await and data integrity in concurrent scenarios
I finally found out the basic mechanism that C# uses to implement an async/await construct (using continuations). However, this led me to question data integrity. Imagine the following:
class ...
0
votes
1
answer
106
views
Performance and thread‑safety ASP.NET Core MVC [closed]
I’ve been working as a .NET C# developer for a little over two years in a software company. For almost a year now, I’ve been leading (as team leader/PM) a project that actually started before I joined....
0
votes
3
answers
123
views
Threading in Rust with mutable objects
I'm quite new to rust and want to do two function in parallel.
shoot(&fleet_a, &mut fleet_b)
shoot(&fleet_b, &mut fleet_a)
since they only take information from one and modify some ...
2
votes
0
answers
217
views
Is the Windows Audio Session API thread safe?
Is the Windows Audio Session API (WASAPI) thread safe? Is it okay to call IAudioClient::Start from one thread and then call IAudioClient::GetCurrentPadding and IAudioRenderClient::GetBuffer from a ...
0
votes
0
answers
46
views
Data Race Issues with `pa_mainloop` in Multithreaded Environments and Their Mitigation
AudioControl::AudioControl(QObject* parent)
: QObject { parent }
, QRunnable()
{
m_loop = pa_mainloop_new();
if (!m_loop)
return;
m_api = pa_mainloop_get_api(m_loop);
...
3
votes
1
answer
144
views
Is it thread-safe to use std::atomic<bool> to control access to a data structure cooperatively, with just loads/stores instead of RMW?
I'm playing around with lockless C++ programming, and I came up with a method for safely(?) transferring ownership of a non-thread-safe data structure (std::unordered_map<int, float> in my ...
1
vote
1
answer
71
views
Is it really safe to work with arrays inside setTimeout/event handlers?
I need to access the same array from main thread and multiple setTimeout/event handlers? May array operation interrupt another array operation when it is called from, setTimeout/event handler function?...
0
votes
1
answer
85
views
How to make Open FGA Async Client work with Flask + Gunicorn?
class FGAClientWrapper:
"""
A synchronous, gevent-friendly wrapper for the async OpenFGA SDK.
"""
def __init__(self, call_timeout: float | None = 10.0):
...