Menu

#151 thread_running Accessed by Both Threads

New
nobody
None
Medium
Defect
2017-02-25
2017-02-25
No

It looks to me like add_edge_detect() in the main thread tests thread_running to decide whether to call pthread_create(), and that new thread sets it. But that new thread might not be scheduled for a bit and add_edge_detect() could return, and be called a second time, see thread_running is still false, and call pthread_create() a second time. There may be other variables that need accessing mutually exclusively.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.