Author Topic: Threaded IO in an editor  (Read 358 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 8117
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Threaded IO in an editor
« 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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: