delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/16/23:40:50

From: "Marcus" <mesthlm AT hem DOT passagen DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: App still hangs on shutdowwn
Date: Thu, 17 Feb 2000 01:23:08 +0100
Organization: Telenordia
Lines: 47
Message-ID: <88ff40$2o9$1@cubacola.tninet.se>
NNTP-Posting-Host: cns2-210-200.cm.starport.se
X-Trace: cubacola.tninet.se 950747072 2825 193.150.210.200 (17 Feb 2000 00:24:32 GMT)
X-Complaints-To: abuse AT algo DOT net
NNTP-Posting-Date: 17 Feb 2000 00:24:32 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi again!
My application seems to STILL hang sometimes on shutdown. And it's because
of the mouse handler.
This is the code I use know:

To start:
bool initmouse(void)
{
  x.ax = 0;
  __dpmi_regs regs;
  regs.x.ax = 0;
  __dpmi_int(0x33, &regs);
  if(regs.x.ax != 0xFFFF) return false;

  callback_info.pm_offset = (long)mousecallback;
  if (_go32_dpmi_allocate_real_mode_callback_retf(&callback_info,
&callback_regs)) return false;
  regs.x.ax = 0xC;
  regs.x.cx = 63;
  regs.x.es = callback_info.rm_segment;
  regs.x.dx = callback_info.rm_offset;
  __dpmi_int(0x33, &regs);

  _go32_dpmi_lock_data(&callback_info, sizeof(callback_info));
  _go32_dpmi_lock_data(&callback_regs, sizeof(callback_regs));
}

To shutdown:
void uninitmouse(void)
{
  __dpmi_regs regs;
  regs.x.ax = 0xC;
  regs.x.cx = 0;
  regs.x.es = 0;
  regs.x.dx = 0;
  __dpmi_int(0x33, &regs);
  _go32_dpmi_free_real_mode_callback(&callback_info);
}

Tell me what I should do to make an SAFE mouse handler that never crash.
Thank you...

--
/regards Marcus



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019