Xref: news2.mv.net comp.os.msdos.djgpp:3186 From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: near pointers "reentrancy" .. Date: Fri, 26 Apr 1996 19:07:49 +0100 Organization: The University of York, UK Lines: 40 Message-ID: References: <4losgf$dff AT ict DOT cec DOT uchile DOT cl> Reply-To: Shawn Hargreaves NNTP-Posting-Host: tower.york.ac.uk Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <4losgf$dff@ict.cec.uchile.cl> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On 25 Apr 1996, HASAN VALDOVINO CARLOS wrote: > I am writting a sound library for DJGPP and I have started to use near > pointers to access conventional memory (where the DMA buffer is allocated). > Evenrything works great, but I'd like to know if the near pointer routines > are reentrant, since I enable/disable them every time the application calls > the routine used to update the audio DMA buffers. The routine can be called > in background from the timer interrupt service routine or from "foreground". General advice for any question of that kind: read the source. It's the best documentation there is, and the libc sources are a useful thing to have around. In your case, I would imagine you will run into problems. I assume what you want to do is just: enable nearpointers mix samples disable nearpointers in your interrupt handler, right? But if nearpointers are enabled in the foreground, this interrupt handler will disable them when it shouldn't. You could add a semaphore flag to count nested levels of enablement, but that is getting messy. Another problem with near pointers is the call the a library function to enable/disable them. You need to lock all the code used inside interrupt handlers, and that is tricky to do with a libc function. You'd probably be better off just enabling near pointers when your program starts up and leaving them enabled. Or use far pointers: you only have to load the segment register once to copy a big block of data, so they can be pretty fast. Shawn Hargreaves. Why is 'phonetic' spelt with a ph? Check out Allegro and FED on http://www.york.ac.uk/~slh100/