[Solved] bank, 4 atm machine input txt files, syncing information between them with semaphores

I know it’s tagged c, but since you spammed it in Lounge<C++>, let me humor you with C++: Live On Coliru #include <algorithm> #include <functional> #include <atomic> #include <fstream> #include <iostream> #include <list> #include <mutex> #include <sstream> #include <string> #include <thread> #include <vector> // not thread-aware: struct Bank { struct Account { int id; int … Read more

[Solved] Error while compiling the code ‘double free or corruption (out)’ using threads in C? [closed]

The *fp is a global variable, so each therad will initialize it with fopen and after finished working try to close it. the *fp is shared between threads (which should not be) so each thread before exiting tries to close the file handle stored in *fp and the double free occurs when multiple threads tries … Read more