1

I have to debug a piece of embedded system. I need to log some values allowing me reproducing code trace. But code is executed in two threads and I'm not able to disable interrupts or to prevent thread switching in any other way. Is it possible in to implement in such environment a simple, safe mutex system for my global trace/logging engine in order to protect thread mixing in it? How to do it?

ardabro
  • 1,907
  • 16
  • 31
  • Curious: why is the stuff listed under http://en.wikipedia.org/wiki/Mutual_exclusion#Software_solutions not suitable for you? – Erik Kaplun Sep 06 '13 at 18:50
  • 3
    OK, what OS/tasker are you using to run your threads, because I've never met one without mutex/semaphore/event synchro. – Martin James Sep 06 '13 at 18:54
  • use something like spinlock (active waiting)? – zoska Sep 06 '13 at 19:07
  • Are you sure you can't disable interrupts? – 0x90 Sep 06 '13 at 19:31
  • MicroC/OS; 4 ARM processors with partially shared RAM. System is really huge. My two threads are only a drops in the ocean. Yes: I can't disable interrupts. I implemented sth myself and now I see it is similar to Dekker's algorithm. It is not 100% trustworthy but probably enough. – ardabro Sep 07 '13 at 00:55

0 Answers0