ADLplug icon indicating copy to clipboard operation
ADLplug copied to clipboard

Dynamic measurement thread issue

Open jpcima opened this issue 5 years ago • 0 comments

The InitTables method of Dosbox to initialize global data has a defect when using the emulator on multiple threads.

Description of the problem:

  • have 2 threads doing Init() each around the same time
  • T1 has entered InitTables(), has set doneTables = true
  • T2 takes over, InitTables() skips because of doneTables flag
  • T2 generates bad audio because tables are not filled

Also, there must be a synchronization to ensure correct sequencing of read and write. Mutex will be fine.

(EDIT I don't use several threads in the worker for measuring so it's not affected; but needed for libADLMIDI's genadldata and I'll copy the changes here)

jpcima avatar Jul 01 '19 14:07 jpcima