race-condition Questions
2
Solved
We have an asynchronous task that performs a potentially long-running calculation for an object. The result is then cached on the object. To prevent multiple tasks from repeating the same work, we ...
Virtuosic asked 7/1, 2010 at 1:20
19
Solved
When writing multithreaded applications, one of the most common problems experienced is race conditions.
My questions to the community are:
What is the race condition?
How do you detect them?
How ...
Mady asked 29/8, 2008 at 15:55
1
I debug Go programs in Visual Studio Code. How can I add the -race argument in launch.json file?
I add config in launch.json like below, but it doesn't work.
"args": ["-race"]
Turley asked 16/1, 2019 at 4:17
3
Solved
I have one table that is read at the same time by different threads.
Each thread must select 100 rows, execute some tasks on each row (unrelated to the database) then they must delete the selecte...
Dictionary asked 5/11, 2010 at 19:40
8
Solved
Let's say I define a following C++ object:
class AClass
{
public:
AClass() : foo(0) {}
uint32_t getFoo() { return foo; }
void changeFoo() { foo = 5; }
private:
uint32_t foo;
} aObject;
The o...
Inheritance asked 22/2, 2013 at 8:51
4
Solved
Here are two potential workflows I would like to perform in a web application.
Variation 1
user sends request
server reads data
server modifies data
server saves modified data
Variation 2:
u...
Across asked 28/8, 2011 at 20:51
3
Solved
I have an operation I need to get done N times and no more. The operation is done by many possibly parallel processes that recieve requests. A process has to check if the counter has exceeded N and...
Primeval asked 5/7, 2019 at 8:33
2
I'm developing a website in Python using the (excellent) Flask framework. In the backend code I use APScheduler to run some cron-like jobs every minute, and I use Numpy to calculate some Standard D...
Bordelon asked 1/7, 2014 at 21:33
4
Solved
You can find on here a very good explanation about what is a race condition.
I have seen recently many people making confusing statements about race conditions and threads.
I have learned that ra...
Assumpsit asked 30/1, 2014 at 17:27
0
I just got a juicy race condition. Consider the following classes:
#include <atomic>
#include <chrono>
#include <iostream>
#include <thread>
class A
{
std::thread th;
std...
Bomar asked 22/9, 2023 at 14:7
9
Solved
I'm having trouble figuring out how to correctly use sync.Cond. From what I can tell, a race condition exists between locking the Locker and invoking the condition's Wait method. This example adds ...
Disgraceful asked 26/4, 2016 at 6:43
5
When using the OAuth 2.0 JWT Refresh token implementation I came across the issue that it's really difficult to implement a solid Refresh Strategy on the Web Browser Client Side. Multiple Tabs can ...
Dense asked 15/5, 2020 at 8:30
1
Solved
Following the question from here, which explains to some degree why getting a std::stop_token internally instead of getting it as parameter to the thread wrapper function leads to a race-condition....
Rateable asked 23/2, 2023 at 10:7
3
Solved
#!/bin/bash
if [ ! -f numbers ]; then echo 0 > numbers; fi
count=0
touch numbers
echo $count > numbers
while [[ $count != 100 ]]; do
if ln numbers numbers.lock
then
count=`expr $count + 1`...
Stgermain asked 18/2, 2015 at 3:53
1
Solved
I'm reading this paper. On the page 11 the paper says:
Unix applications can obtain access to files without encountering symlink races. This is important for normal application programmers who, fo...
Incredulity asked 27/1, 2023 at 22:45
4
I found the following example for condition variable on www.cppreference.com, http://en.cppreference.com/w/cpp/thread/condition_variable. The call to cv.notify_one() is placed outside the lock. My ...
Principal asked 3/3, 2016 at 14:55
2
In Django views, we can use select_for_update() to prevent race condition(lost update or write skew) so race condition doesn't happen in Django views with select_for_update(). *I used Django 3.2.16...
Bittencourt asked 17/10, 2022 at 9:31
2
Is there a way to run the django tests using multiple threads and force the race condition? I want to make sure that the code path that handles the transaction errors is executed. To be slightly mo...
Hexamethylenetetramine asked 23/3, 2014 at 6:38
2
Consider the first thread function and global variables:
std::mutex mut;
std::condition_variable officer;
bool firstPlayerIsReady = false;
bool secondPlayerIsReady = false;
void firstPlaye...
Humbert asked 4/2, 2019 at 9:47
2
I'm trying to run a functional test for a node app.
In my package.json I have the following scripts:
"scripts": {
"web-server": "NODE_ENV=test node app.js &",
&q...
Whitehead asked 30/9, 2019 at 18:59
4
Solved
The problem my team and I have been trying to solve involves multiple ec2 instances each with their own independent, parallel access to the same S3 bucket.
The issue arises as a race condition whe...
Manmade asked 21/8, 2017 at 19:0
1
Solved
Using this question as basis I implemented a pseudo-random number generator with a global state:
__global uint global_random_state;
void set_random_seed(uint seed){
global_random_state = seed;
...
Sclera asked 17/2, 2022 at 9:34
2
Solved
I searched in many web pages to find what phrase exact should I place in settings.json in VS Code Golang extension (released by Microsoft) to add a build flag (in my case, race detector)?
I added:...
Cent asked 19/6, 2019 at 13:0
2
I have this validation rule on POST request method inside a controller:
class CreateOrderController extends Controller
{
public function create(Request $request)
{
$this->validate($request, [...
Chaparajos asked 8/9, 2020 at 8:35
3
I'm new to plpgsql and I'm trying to create function that will check if a certain value exists in table and if not will add a row.
CREATE OR REPLACE FUNCTION hire(
id_pracownika integer,
imie ch...
Cave asked 13/4, 2015 at 7:59
1 Next >
© 2022 - 2025 — McMap. All rights reserved.