Can I prevent a Linux user space pthread yielding in critical code?

前端 未结 3 1949
没有蜡笔的小新
没有蜡笔的小新 2020-12-18 07:34

I am working on an user space app for an embedded Linux project using the 2.6.24.3 kernel. My app passes data between two file nodes by creating 2 pthreads that each sleep

3条回答
  •  囚心锁ツ
    2020-12-18 07:53

    I think you'll want to use mutexes/locks to prevent race conditions here. Mutexes are by no way voodoo magic and can even make your code simpler than using arbitrary system-specific features, which you'd need to potentially port across systems. Don't know if the latter is an issue for you, though.

提交回复
热议问题