Skip to content

allegrex cache and synchronization, volatile #182

Closed Answered by rofl0r
rofl0r asked this question in Q&A
Discussion options

You must be logged in to vote

alright, after testing all kinds of different sync / atomic / spinlock primitives without success, it turned out that the fundamental issue seems to be that the PSP doesn't actually switch tasks by its scheduler unless a blocking syscall or sleep() is called. my spinlock was waiting forever for the other task to finish its work - not because the read or writes were optimized away, cached, etc - but because the other task didn't actually get any cpu time to set its value.
since i couldn't find any syscall that does "suspend current thread until another thread blocks" i now solved the issue by calling SDL_Delay(1) before trying to read the value the other thread is supposed to set when it f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rofl0r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant