Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2019-12-03 00:00:00Z and 2019-12-04 00:00:00Z
but if i singiggle snuggly my sketchy pointer to a object in my thread i can happily call methods there even if they get executed in other threads as well?
When you modify a variable another thread could be reading that variable and that causes issues. To fix it you can have a lock, that makes sure only one thread is using the variable at a time
my main thread sets the state var to running then spawns a thread if not running already and the thread then sets state to done and the main thread checks if its done in the gameloop
Well the writes and reads are not atomic, so the thread can set the value halfway, then the other thread can read a trap representation, which invokes undefined behaviour
but i just realized during the rank calculation other ranks could be saved and then there is read and write to file at the same time which is not too good
You could maybe get fancy with creating a hashtable of semaphores that get triggered when a modifying thread quits and is removed if there are 0 threads for a file left
so in main thread where i have to write and do important stuff like saving i create lock files and from the rank thread i just abort if lock file exist and done
14:50
so /rank doesnt work when a file is currently updated
but if the file is opened non exclusively and a write happens inbetween the reads, the second read might read a half modified file, or a fully modified file, or a non modified file, it all depends on how the write is scheduled by the OS
14:54
@ChillerDragon yeah what you proposed works, as long as /rank doesn't work if there is a lockfile it's fine
@Cellegen | HU i did not find any tool for porting maps that really convinced me. And my attempt to implement ddrace layers to 0.7 client was also kinda experimental so idk when that is gonna happen.