Path: utzoo!mnetor!uunet!cbmvax!rutgers!sunybcs!bingvaxu!leah!uwmcsd1!ig!agate!ucbvax!CORY.BERKELEY.EDU!dillon From: dillon@CORY.BERKELEY.EDU (Matt Dillon) Newsgroups: comp.sys.amiga Subject: Re: forbid/permit Message-ID: <8801270740.AA05639@cory.Berkeley.EDU> Date: 27 Jan 88 07:40:01 GMT Sender: usenet@ucbvax.BERKELEY.EDU Lines: 32 You are doing exactly the right thing. It is quite kosher to use Forbid()/Permit() for short periods of time as you are doing. In this particular case, the compiler probably gets it down to one instruction anyway (but of course you can't *assume* that from the C code). Forbid()/Permit() simply disable task switching. The really voltile calls are Disable()/Enable() which disable interrupts (and thus task switching as well). Disable()/Enable() is used mainly by the OS to, for instance, make message handling calls atomic. -Matt Your message: :if (k==0) { : Forbid(); :wdw->flags &= RMBTRAP; :Permit(); :} : :My question is: : :can I use any other way to get the same thing done? I hear that :forbid/permit are not quite "kosher" on the amiga... : :What I am trying to do in the above code is make the right mouse button :trapped only under a certain situation on the screen, and then be able :to turn off or on the trapping as needed. wdw is a pointer to my window, :and the flags are currently set to other codes. I do not want to disturb :the other flags. : :Hans Bechtel