Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about test-and-set

Read more about test-and-set

python (65.2k questions)

javascript (44.3k questions)

reactjs (22.7k questions)

java (20.8k questions)

c# (17.4k questions)

html (16.3k questions)

r (13.7k questions)

android (13k questions)

Questions - test-and-set

test_and_set makes the thread deadlock

#include<bits/stdc++.h> using namespace std; int cnt=0; int locked=0; int test_and_set(int * lock){ int temp=*lock; *lock=1; return temp; } void cntOnes(int t){ while(test_and_se...
test-img

VEMBU KARTHICK T

c++

multithreading

thread-synchronization

busy-waiting

test-and-set

Votes: 0

Answers: 1

Latest Answer

First of all, Why should I not #include <bits/stdc++.h>? With that out of the way, unfortunately, your whole code is a great big data race. You simply cannot use ordinary variables to communic...
test-img

Nate Eldredge

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved