clementgallet / libTAS

GNU/Linux software to (hopefully) give TAS tools to games
GNU General Public License v3.0
476 stars 56 forks source link

Ensure that native created threads will be passed the native flag #580

Closed CasualPokePlayer closed 8 months ago

CasualPokePlayer commented 8 months ago

Also make sure ThreadInfo constructions use the correct constructor (new ThreadInfo is analogous to malloc while new ThreadInfo() is analogous to calloc; granted libtas overrides malloc to calloc so this probably doesn't matter in practice, but the compiler probably shouldn't be getting any funny ideas over UB here)

clementgallet commented 8 months ago

The

    if (GlobalState::isNative())
        return orig::pthread_create(tid_p, attr, start_routine, arg);

was introduced in 56220f4dede11aacec84a609d64f67752c4800ad for wine. I'm unsure if it wouldn't be better to remove it and capture even threads created from code flagged as Native, so that we can suspend them during savestates?

Your suggestion is more conservative though.