Mercurial > dwindows
diff os2/dw.c @ 1528:5facb5380944
Added dw_main_quit() function for exiting the dw_main() loop.
Also some cleanups added to dw_exit() on OS/2 and Windows.
Changed OS/2 to no longer destroy the message queue when leaving dw_main()... it should be done in dw_exit().
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 05 Jan 2012 15:45:11 +0000 |
parents | 65861fedc4b4 |
children | 783a464afab2 |
line wrap: on
line diff
--- a/os2/dw.c Tue Jan 03 15:59:00 2012 +0000 +++ b/os2/dw.c Thu Jan 05 15:45:11 2012 +0000 @@ -4015,6 +4015,8 @@ return rc; } +static int _dw_main_running = FALSE; + /* * Runs a message loop for Dynamic Windows. */ @@ -4026,15 +4028,24 @@ /* Make sure any queued redraws are handled */ _dw_redraw(0, FALSE); - while(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) + /* Set the running flag to TRUE */ + _dw_main_running = TRUE; + + /* Run the loop until the flag is unset... or error */ + while(_dw_main_running && WinGetMsg(dwhab, &qmsg, 0, 0, 0)) { if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); WinDispatchMsg(dwhab, &qmsg); } - - WinDestroyMsgQueue(dwhmq); - WinTerminate(dwhab); +} + +/* + * Causes running dw_main() to return. + */ +void API dw_main_quit(void) +{ + _dw_main_running = FALSE; } /* @@ -10521,7 +10532,16 @@ */ Root = NULL; + /* Destroy the main message queue and anchor block */ + WinDestroyMsgQueue(dwhmq); + WinTerminate(dwhab); + + /* Free any in use modules */ DosFreeModule(wpconfig); + DosFreeModule(pmprintf); + DosFreeModule(pmmerge); + + /* And finally exit */ exit(exitcode); }