What are you working on, /g/?
Old thread: >>62162915
Reposting:
Let's say I want to transpile an statically-linked x86 binaries to arm. Can I write the software to do that from scratch without going insane?
How much harder would doing the same thing for dynamically linked software be?
is this victim to a race condition? if so, how do you fix that?access(mutex){
if (mutex->lock == UNLOCKED){
mutex->lock = LOCKED;
return UNLOCKED;
}
else return LOCKED;
}
i'm thinking of two threads running this at the same time
thread one would run the first line, immediately followed by thread 2 doing that first line. both of them read the mutex is unlocked. then thread 1 sets the mutex to locked, as well as thread 2 doing that right after. then both of them get unlocked returned from this function. how would you avoid that? or does that not happen?
>>62168024
Does "access" protect the mutex in any way? If not, then yes that will be a race condition
>>62168024
Afaik it isn't possible to correctly implement a mutex in plain C. You need help from assembly to ensure certain operations are synchronized.
>>62167573
Will I be in pretty good shape if I work through this entire book? I'm not new to programming, but I feel like i'm stuck at whatever is between complete beginner and intermediate.
>>62168951
Sorry, forgot link:
https://repo.zenk-security.com/Programmation/O%20Reilly%20-%20Practical%20C%20Programming,%203rd%20Edition.pdf
>>62168024
You need to use the CMPXCHG instruction if you are using x86. But you should use your operating system's mutex implementation as it will abstract it away for you.
>>62167573
pic saved
thanks op
I need to write a relation which is both reflexive and symmetric, but not transitive. does pic related satisfy this?
>>62169935
No. D(a,b) is always equal to |a - b|
>>62170416
What? That's the point...
>>62170467
SO it's transitive.
>>62170533
Do you understand what transitive means?
We already have a thread though >>62167566
>>62170555
aRb -> bRc -> aRc
Bought this off of ebay, is this the same as the second edition with the white cover that I often see?
>>62171895
Must be, see if recursion in the alphabet index has the same page number as recursion does.
>>62171958
It does, thanks.