You need to sign in or sign up before continuing.×
Beta

Threading: Boolean Flags Aren't Enough

Description:

Threading: Boolean flags aren't enough for synchronization

Summary

When starting off with threading sometimes it would seem that using boolean flags to protect critical sections should be enough. That's not always the case, as demonstrated with this Kata. Your task is to fix the bug so that we won't get into the critical section more than once.

Issue

The kata presents a solution, wherein your have threadCode which is executed in some number of threads. In this code you make a call to a critical section, which should only be called by one thread at a time. The example provided is subject to a race condition which needs to be mitigated to ensure we're calling the critical section in only one thread at a time. The critical_section may be performing significant work.

Threads
Debugging

Similar Kata:

Stats:

CreatedMar 6, 2020
PublishedNov 10, 2020
Warriors Trained163
Total Skips29
Total Code Submissions120
Total Times Completed28
C Completions28
Total Stars2
% of votes with a positive feedback rating71% of 12
Total "Very Satisfied" Votes6
Total "Somewhat Satisfied" Votes5
Total "Not Satisfied" Votes1
Total Rank Assessments9
Average Assessed Rank
6 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • bp1222 Avatar
Ad