Skip to main content
Filter by
Sorted by
Tagged with
-2 votes
1 answer
72 views

I found handle mutex using Process Explorer. I can close it with this programm, then i'm able to launch second instance of PrivodBondar.exe. With chatGPT help I wrote powershell script which closing ...
555Russich's user avatar
1 vote
3 answers
221 views

Is this code correct / advisable style? That is, is the lock being returned guaranteed to keep the mutex locked through the process of being returned , as opposed to say unlocking then re-locking (or ...
M.M's user avatar
  • 143k
0 votes
0 answers
48 views

I want to know if mutual exclusion is upheld for these 2 process'. Assuming everything is atomic int ba = 0 , int bt = 0 Process D while(true) { D1: non critical section D2a: if (bt = -1) {...
sharkey101's user avatar
1 vote
0 answers
85 views

I want every time a student is created to display who has been created and in which department they study. I'm stuck and I don't know what parameters to pass to printInfo(), do you have any idea? I ...
mitsislav's user avatar
1 vote
1 answer
83 views

I have created a "File" class for a C++ project of mine, and its based on ofstream. Here is the simplified code: file.h #include <fstream> #include <mutex> #include <...
Keshav V.'s user avatar
2 votes
1 answer
77 views

This code completes right away (playground): use std::sync::Mutex; fn f(_: usize, _: usize) {} fn main() { let m = Mutex::new(0); let i = { *m.lock().unwrap() }; let j = { *m.lock()....
ynn's user avatar
  • 5,077
4 votes
1 answer
97 views

For the following code in javascript I want to know if there are concurrent api requests to increment count is there any possibility of a race condition considering the fact that javascript is single ...
ashishpm's user avatar
  • 491
0 votes
1 answer
198 views

for some reasons that one of my mutex causes "deadlock" in the code. in the code below inside the ability.perform function the hero_clone which is a mutex is deadlocked and after using lock()...
Mmd's user avatar
  • 3
1 vote
1 answer
82 views

I am designing a parallel matrix multiplication algorithm using the POSIX threads (pthread) library, which is an improvement on the CPU version of gpt.c by Andrej Karpathy. First, I ran it directly ...
Ldemon's user avatar
  • 23
2 votes
2 answers
65 views

This code should stop at 15 characters (line), but it does not and it keeps going infinitely. The main problem with this code is that the condition variable logic doesn't allow all threads to ...
mrd's user avatar
  • 31
2 votes
0 answers
47 views

I'm writing a very simple, shared ticket lock whose goal is to be fair for both readers and writers in the order they arrive. Everyone gets in the same line Line-contiguous reader groups get ...
Michael220's user avatar
2 votes
1 answer
100 views

I am playing with calculating pictures of fractals using a GPU and Vulkan and "utilizing the power of compute shaders". There I ran into one problem and could not really find a satisfying ...
Gregor Grunz's user avatar
1 vote
0 answers
32 views

I define a pthread_mutex_t in a shared object library, initialize it in a process and use it in a function of the library. Following the structure of the code. With processes I mean separated running ...
bui3's user avatar
  • 152
0 votes
2 answers
98 views

I'm trying to mutate a dynamically sized (i.e. under certain conditions, new values are pushed, and pop() gets called in every iteration) Vec in parallel. Am I doing anything wrong in this working ...
Chad's user avatar
  • 1,530
0 votes
0 answers
54 views

I'm connecting to a Lakeshore 336 Temperature controller from Linux Mint via pyserial. My app works relatively well and has operated for months at a time without error. However, it sometimes happen ...
Alexis R Devitre's user avatar
1 vote
1 answer
165 views

I am working on the RTOS support in our SW components. There are some scenarios when it makes sense to create a copy of global variables into local variables in a critical section (e.g. protected by ...
Quentis's user avatar
  • 23
-2 votes
1 answer
157 views

I have a decode function that decodes a string and internally uses a map to store already-decoded values for efficiency. This function is accessed by multiple threads (using pthread), so to prevent ...
Ghost's user avatar
  • 96
0 votes
1 answer
147 views

I have a bunch of functions in my rust app that all get a Mutex as a parameter, which holds an Option. I need that Mutex because the functions will be executed in threads, and I need the Option ...
axolotlKing0722's user avatar
1 vote
1 answer
171 views

I have been learning std::condition_variable recently and there is just some question that I cannot understand. Cppreference and many other tutorials give example like this: std::mutex m; std::...
lustfully's user avatar
1 vote
1 answer
75 views

I want to construct a resource pool which maintains a set of resources shared between several threads. Each thread pops a resource from the pool, uses it to perform some work and pushes the resource ...
user2448758's user avatar
1 vote
1 answer
78 views

I was experimenting with pythons multiprocessing and threading modules and, stumbled upon something rather strange. have a look at the following program: import threading import time import ...
yufusuf's user avatar
  • 13
1 vote
1 answer
87 views

I am reading the code in flutter engine at https://github.com/flutter/engine/blob/main/shell/common/platform_view.cc#L58 I want to ask that if latch.Signal() is reached before latch.Wait(), will it ...
songzh's user avatar
  • 65
0 votes
0 answers
39 views

I'm facing a serious issue when deploying executables built by Windows GitHub runners: any executable that uses std::unique_lock<std::mutex> is unreliable! It compiles correctly, but will ...
Pascal T.'s user avatar
  • 4,111
2 votes
0 answers
63 views

I know there are many discrepancies between them, e.g., atomics may incur spinning while mutexes may involve blocking. But what I want to know is how they differ in terms of cacheline synchronization. ...
Xavier Z's user avatar
  • 402
0 votes
1 answer
74 views

I am trying to run two threads. The first one will run infinitely and the other one will run when mutex lock on first will be cleared. I don't want to change the basic structure of code like, the loop ...
Charlie_57's user avatar
1 vote
0 answers
161 views

I have write the following member function in my class which executes in a seperate thread and it sets the _cancellationRequested to true and execution function which runs in a seperate thread detects ...
Sujith Gunawardhane's user avatar
0 votes
1 answer
74 views

I am developing a multi-threaded network application focused on packet processing that involves sender and receiver threads. This application runs on a single-core CPU, which adds complexity to how ...
jxqnzzj's user avatar
0 votes
1 answer
59 views

I'm trying to automate a sync relation between a win application and a java application. My criteria is : start win and jav application execute command in jav application wait for response from jav ...
Raj Sawant's user avatar
0 votes
1 answer
80 views

I use two mutexes for enqueueTS() and dequeueTS(), so that writer and reader threads can run simultaneously without waiting for each other. However, both enqueueTS() and dequeueTS() can affect member ...
Anderson Chris's user avatar
0 votes
1 answer
114 views

I'm using shared, robust pthread mutexes to protect some shared memory areas I have in my application. Since my program is managed by a systemd service, it could potentially be restarted, in which ...
Alessandro Bertulli's user avatar
0 votes
1 answer
71 views

I'm learning Rust and just finished the Fearless Concurrency chapter in the Rust book, so am trying to fill up the rows of a matrix in parallel. My matrix is large, so I send a chunk of rows to each ...
Raf's user avatar
  • 1,789
0 votes
1 answer
52 views

If I'm getting it right, is it possible in the Linux pthread C API to use robust mutexes, that can be shared across processes (by placing them in shared memory), and that allows you to acquire the ...
Alessandro Bertulli's user avatar
0 votes
1 answer
65 views

I'm starting to learn about caching and have thought of the following problem, and really only see one way to solve it but I'm sure I am missing something Lets image that I have two endpoints, one for ...
JackG's user avatar
  • 73
-2 votes
1 answer
136 views

I have some urls, then i divide it with chunks and iterate them concurrently, saving results in vec using cloning: pub fn collect_parm_list(url_list: Vec<String>) -> Result<Vec<String&...
middleStackoverflower's user avatar
-1 votes
4 answers
171 views

I am starting with designing thread safe data structure and looking to implement a concurrent vector that hides multi-threading complexity for the user and that offers thread safe clear function (...
omarekik's user avatar
0 votes
0 answers
54 views

I examined the Linux mutex implementation code, where if the lock is held by others, the lock function creates a mutex_waiter struct on the stack (as a local variable) and adds this struct as a node ...
Yijue Xu's user avatar
1 vote
1 answer
318 views

I'm trying to measure the system time and user time for pthread_mutex_lock(), and this is the function I came up: void measure_mutex_lock_time(double *user_time, double *system_time) { ...
union77's user avatar
  • 145
0 votes
1 answer
643 views

There are two types of mutex in Go: Mutex and RWMutex Mutex offers func Lock() and func Unlock(). RWMutex offers those functions plus func RLock() and func RUnlock(). From what I understand, we ...
tbmsilva's user avatar
  • 467
-1 votes
1 answer
69 views

Unable to understand this dead lock situation in golang, i have below to go code with pub and sub pattern package main import ( "fmt" "sync" ) func main() { cond := ...
Hari's user avatar
  • 1,623
1 vote
2 answers
987 views

I'm working on a Go microservice where I am using robfig/cron package to schedule jobs, initially thought of using time.Ticker() but package made it easier for me. My question is how to ensure cron ...
Harry's user avatar
  • 45
1 vote
1 answer
105 views

I'm trying to make a thread_join function in WebAssembly by setting a mutex to 1 in the main thread, and then launching a thread. the thread unlocks its mutex before exiting. the main thread can get ...
Ali Qanbari's user avatar
  • 3,131
13 votes
1 answer
273 views

Consider the following code, with adjacent mutex sections containing shared memory accesses: std::mutex mutex; int x; void func() { { std::lock_guard lock{mutex}; x++; } { ...
MC ΔT's user avatar
  • 677
0 votes
1 answer
163 views

I can initialize a std::mutex with auto mtx = std::mutex(); but it seems impossible to push one into std::vector<std::mutex>: both std::vector<std::mutex> vec; vec.push_back(std::...
Rahn's user avatar
  • 5,565
1 vote
2 answers
63 views

I am new to threads and multithreading.(Win socket API) I am trying to achieve the sequence of tasks in 2 threads with proper synchronization. no. of threads 2 : Thread_A and Thread_B Thread_A{ ...
Yashwant Rao's user avatar
4 votes
3 answers
238 views

I know if I lock std::mutex twice in one thread, it will cause a deadlock. So, I globally replaced std::mutex with std::recursive_mutex. Does only using std::recursive_mutex mean I will never ...
kevin h's user avatar
  • 143
0 votes
4 answers
137 views

I have an abstract class like this : class Thing { public: Thing(); virtual ~Thing(); static QMutex s_mutex; virtual void load() = 0; virtual void translate() = 0; virtual ...
Charles's user avatar
  • 1,329
0 votes
1 answer
20 views

I have an unknown number of processes that create independent data, and one function that modifies all existing data. I need to be able to prevent the modification of data when it is being created (or ...
Charles's user avatar
  • 1,329
2 votes
1 answer
136 views

I have a class managing vector data using the singleton pattern. class DataManager { public: static DataManager& GetInstance() { static DataManager instance; return instance; ...
白镜明's user avatar
31 votes
1 answer
14k views

Recently I installed the latest Visual Studio 2022 v17.10 to build my programs, and initially all went well. But after some other program installation, my programs started failing immediately on start ...
Fedor's user avatar
  • 24.7k
5 votes
1 answer
422 views

does c++ std::mutex get poisoned when a thread holding a lock gets terminated abruptly. If so, how do I recover that mutex in another thread?
Harry's user avatar
  • 4,146

1
2
3 4 5
97