Skip to content

Fix thread safety in DelayedFuncTask class#5

Open
p0358 wants to merge 2 commits intoTitanfall-Mods:masterfrom
p0358:master
Open

Fix thread safety in DelayedFuncTask class#5
p0358 wants to merge 2 commits intoTitanfall-Mods:masterfrom
p0358:master

Conversation

@p0358
Copy link
Copy Markdown

@p0358 p0358 commented Nov 14, 2022

RunFrame() was accessing m_delayedFuncs insecurely without holding a lock on mutex.

I also changed std::mutex to std::recursive_mutex, because if a delayed func called from RunFrame() calls AddFunc() again itself, it would create a deadlock with normal mutex...

@p0358
Copy link
Copy Markdown
Author

p0358 commented Nov 14, 2022

Actually now that I think about it, TTF2SDK::AddFrameTask and then removal in main frame hook is also unsafe, idk if the codebase assumes a possibility someone might add frame task from another thread, I see so far the only AddFrameTask calls are done in main thread... Should I fix it too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant