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

Hello Ivan,

On Apr 21 13:25 96, Ivan Joergensen of 2:238/64.17 wrote:

 IJ> Eidrrk... So what your are recommending is that I use 
 IJ> DosDevIOCtl() under OS/2 2.x ? Do you know if there are 
 IJ> simular peculiarities with KbdRead() ? (Where it is 
 IJ> essential that the thread is stopped so it does not 'eat' a 
 IJ> character from the child processes)

a) i'm not recommending it. i just wrote what i've done.

b) about kbd problems. (i wrote this stuff about 4 years ago - so i can't
remember exactly. here's the start from my kbd routine:


* HISTORY  : 92-10-22 | MS | CREATED
*          : 93-09-13 | MS | use DevIO's (due to a bug in OS/2 2.1 Kbd...)
**%{at}E*********************************************************************%{at}E* /
static void _ReadKeyAsync(void)
{
 KBDKEYINFO kbci;
 int key;
 int ekey;
 _MOUSEENVIR *pme = _pme;

#if 1

 USHORT rc,usAction;
 USHORT cRecords;
 HFILE _hfKbd;
 BYTE  bInpMode = BINARY_MODE;

 rc= DosOpen("kbd$",
             &_hfKbd,
             &usAction,
             0L,
             0x0000,
             FILE_OPEN,
             0
             |OPEN_FLAGS_FAIL_ON_ERROR
             |OPEN_SHARE_DENYNONE
             |OPEN_ACCESS_READWRITE
             ,0L);

 usAction = BINARY_MODE;
 DosDevIOCtl(0L, &bInpMode, KBD_SETINPUTMODE, IOCTL_KEYBOARD, _hfKbd);

 while (1)
   {
    cRecords = KBD_READ_WAIT | 1;
    DosDevIOCtl(&kbci, &cRecords, KBD_READCHAR, IOCTL_KEYBOARD, _hfKbd);


( i think the problem was something like :

   my readKeyAsync is pending in a getch() call (or in a KbdChar)
   in another thread i tryd to READ the keyboard state (isCtrlDown...)
     -- the other thread is my ReadMouseAsync thread. and when a mouse Event
     -- occured i stored the keyboard flags in the mouseMove message i
     -- created.

c) my old vio 16bit app looks a bit different (so maybe i missed one of the problems)

  main
 {
  start message queueing thread
    start mouse and keyboard thread
  
  // the mouse and keyboard threads sents key messages and mouse messages to 
  // the message queue. everyone who is interrested can read from there.
  // (i wrote a getch(), unget() routine which just read from and write to
the queue. (the unget write to the top of the queue...)
  
  .... run the application
  
  ...
 } // just terminate. 

i never actually tried to shutdown the threads.

(mh. i think the reason why i changed to the Mouse device driver calls
under 2.x was as follows (looks like i'm starting remembering)

   we are running multiple .exes in 1 screen session. the screen session is
a VGA graphic session. and since 2.x the Mou* calls had problems when used
in this environment. (under 1.x everything worked with the Mou* calls). at
the end of the app i've done a DosClose of the handle returned from
DosOpen(mouse$)

  this worked till 2.1 GA arrived. then the DosClose killed OS/2. 

 IJ> This is unfortunatly not an option to me, because the 
 IJ> thread has to be stopped when I start other processes in the 
 IJ> same session.

i've not stopped the threads. i have my kbd and mouse handling in a single
shared dll:


LIBRARY LogiInp
PROTMODE
DESCRIPTION '(C)KirchnerSoft 1992'
DATA SINGLE SHARED

 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 888 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™.