The MASM Forum

Microsoft 64 bit MASM => Examples => Topic started by: hutch-- on October 27, 2020, 02:33:58 PM

Title: Threaded IO in an editor
Post by: hutch-- on October 27, 2020, 02:33:58 PM
For what is very simple code, you can fully isolate and app that loads and saves files from locking up if the load or save is long. The example creates two suspended threads which are resumed for each operation then suspended in the thread until the next time it is called. Normal Windows messaging is used to notify the main thread when the called thread has suspended its operation.

Note that the editor has no confirmation as I tried to keep it as simple as an editor can be. The sections of code that operate the threads are marked in this format,

            ; ||||||||||||||||||||||||||

              mov lFlag, 1                      ; set the exclusion flag so the button cannot
                                                ; be pressed until the thread finishes
              rcall ResumeThread,lThread

            ; ||||||||||||||||||||||||||

The two threads used are at the bottom of the source code.