On Tue Mar 5 19:28:14 2024 +0000, Alex Henrie wrote:
I can certainly export those two functions from krnl386 and then call them from mmsystem. Out of curiosity, what do you mean by "declarative" in this context?
I've been thinking about this since yesterday and although we could make mmsystem call a `__wine_suspend_all_tasks` function or a `__wine_wow_callback16` function that has an argument to specify whether to suspend other threads or to lock the Win16Mutex, it seems much less elegant. Here's why: If the callback is called from a task thread, it must be the current task thread because 16-bit Windows didn't have preëmptive multitasking, and TASK_SuspendAll has no effect. (We could even detect that case by checking whether the Win16Mutex is already locked by the current thread, and skip the call to TASK_SuspendAll if it is.) If the callback is called from a non-task thread, it must be a simulated hardware interrupt that needs to call TASK_SuspendAll. We don't have to change every function that might call WOWCallback16(Ex) from a different thread because WOWCallback16Ex can decide what to do based on whether it was called from the current task thread or from a different thread; it doesn't need any additional information.
Does that make sense, or is there something I'm missing?