flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Question about thread safety |
Author |
|
Tomasz Grysztar 10 Jul 2018, 13:51
What hurts thread safety is the use of global variables. If you tried to call fasm in multiple threads to assemble many sources in parallel, all the threads would try to use the same global variables and would destructively interfere with each other.
It is possible to make fasm.dll safe with CreateMutex, in fact I do not know why I did not do that. This would ensure that every time fasm_Assemble was called in another thread it would have to wait until the first thread finishes its job. Of course this would also mean that assembling multiple files in parallel would still be impossible. In case of fasmg it is possible to put "variables.inc" in a "local" block (or simply "virtual at ebp-size") and have it use local variables of an instance of outer procedure, because EBP is never used anywhere in the fasmg engine so addressing every variable through EBP is safe. Therefore running multiple assemblies in parallel would be possible in this case. |
|||
10 Jul 2018, 13:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.