TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Ivan Joergensen
from: Mario Semo
date: 1996-04-15 11:58:12
subject: Aborting MouReadEventQue

Hello Ivan,

On Apr 08 00:45 96, Ivan Joergensen of 2:238/64.17 wrote:

 IJ> I am having trouble shutting down a thread blocked on a
 IJ> MouReadEventQue() call.

:-), i've reported this problem to IBM sometime in 1993. the last version
of OS/2 you can kill a thread with a pending MouRead was OS/2 1.3. 

I changed all my Mou* calls into the equivalient DosDevIOCtls.

 IJ> void mouseReaderThread() {
 IJ> //this is done in a secondary thread
 IJ> while(!please_terminate) {
 IJ> MOUEVENTINFO mei;
 IJ> USHORT wait=1;
 IJ> APIRET rc=MouReadEventQue(&mei, &wait, hmou);
 IJ> ...
 IJ> }
 IJ> }


:-), looks like same code. (note: the following is from my 16 bit app)


...
#define _MouseReadEventQue(pme,pwf,hd)\
      DosDevIOCtl(pme,pwf,MOU_READEVENTQUE,IOCTL_POINTINGDEVICE ,hd)
....

static void _ReadMouAsync(void)
{
 MOUEVENTINFO mouseev;
 USHORT usfWait = MOU_WAIT;
 _MOUSEENVIR *pme = _pme;

 while (1)
   {
    if (_MouseReadEventQue(&mouseev,&usfWait,pme->_hmou))
      DosBeep(100,100);
    DosEnterCritSec();
    pme->_mouseev = mouseev;
    DosExitCritSec();
    DosSemClear(&pme->_ulSemMoDataAvail);
   }
}

you can terminate such threads. PS: under OS/2 2.1 the system traps a few
seconds after program shutdown, when you try a DosClose of the Mouse Device
driver. (this was NO problem under OS/2 1.x and 2.0). I've never tested it
with later versions. it is ok to terminate the main thread of the app and
this mouse reading thread will terminate too.

 WARPED!, Mario

--- Msgedsq/2 2.2e
* Origin: LC/32 Development Team-Vienna-Austria (2:310/14.11)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 310/14 1 24/999 2/777 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.