Recently __wut_getreent got implemented which uses OSGetThreadSpecific/OSSetThreadSpecific to store some thread specific data. This works fine for regular homebrew, but for WUPS/WUMS (Plugin/Module system) we might end up using a reent within a (Cafe OS) thread we do not control (e.g. due to function replacing/patching). In this case using/overriding the "regular" thread specifics might then result in undefined behaviour. To avoid this I propose to the use the "reserved" bytes of the OSThread struct for custom thread specifics which are exclusively reserved for wut.
Contra:
Using the reserved bytes is/feels quite hacky. Forcing every homebrew do this this feels even more hacky.
If Nintendo drops an update and decides to use this reserved bytes all homebrew break
Pro:
wut homebrew can again use all "regular" thread specifcs
Using these reserved bytes is documented in wut. If this won't get merged I probably end up using the bytes anyway for WUPS/WUMS, but then it's less obvious they are actually used by something.
We won't need separate getreent implementations for WUPS/WUMS.
I am personally not really sure how to fix it. Using these reserved bytes feels indeed very hacky but seems overall to be the easiest and cleanest solution.
Open for discussion.
Recently
__wut_getreent
got implemented which usesOSGetThreadSpecific
/OSSetThreadSpecific
to store some thread specific data. This works fine for regular homebrew, but for WUPS/WUMS (Plugin/Module system) we might end up using a reent within a (Cafe OS) thread we do not control (e.g. due to function replacing/patching). In this case using/overriding the "regular" thread specifics might then result in undefined behaviour. To avoid this I propose to the use the "reserved" bytes of the OSThread struct for custom thread specifics which are exclusively reserved for wut.Contra:
Pro:
getreent
implementations for WUPS/WUMS.I am personally not really sure how to fix it. Using these reserved bytes feels indeed very hacky but seems overall to be the easiest and cleanest solution.