2 ms·
I ran into this problem last year, that ordinary mutexes were not working out due to various reasons. Since I do embedded programming, I looked through the ARM
by unwind 13y ago
I ran into this problem last year, that ordinary mutexes were not working out due to various reasons.
Since I do embedded programming, I looked through the ARM manuals and documentation, to see what they have on offer.
I ran into the lovely LDREX and STREX instructions, which are just awesome.
It was pretty trivial to rewrite e.g. a custom allocator that used to grab a mutex, poke its internal freelists, and release the mutex so that it instead does the poking with LDREX/STREX, thus obtaining thread-safety while doing the actual work it wanted to do. Lock-free programming can be beautiful like that.
See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204f/Cihbghef.html http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.... for the instruction reference on LDREX/STREX.