Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!im4u!ut-sally!ut-ngp!mic From: mic@ut-ngp.UUCP Newsgroups: comp.sys.amiga Subject: Re: ASSIGN: solution Message-ID: <4645@ut-ngp.UUCP> Date: Sun, 8-Feb-87 19:46:41 EST Article-I.D.: ut-ngp.4645 Posted: Sun Feb 8 19:46:41 1987 Date-Received: Tue, 10-Feb-87 03:27:16 EST References: <131@batcomputer.tn.cornell.edu> Reply-To: mic@ngp.UUCP (Mic Kaczmarczik) Organization: UTexas Computation Center, Austin, Texas Lines: 35 Keywords: ASSIGN, Avoiding DOS Insert-Disk Requester Summary: Using Forbid()/Permit() is a good idea In article <131@batcomputer.tn.cornell.edu> hsgj@batcomputer.tn.cornell.edu (Dan Green) writes: >If you remember, I had a problem where I needed to know whether >a name was ASSIGNed before I used it. Mike Meyer suggested checking >the data structure Assign uses. Following this advice, I was able to do >just what I wanted. Anyways, since the solution was prompted by a >net suggestion, I thought I'd share it: > ..... [ Program that searches the DOS device list to see if a particular name is ASSIGNED or not] > > -- Dan Green >-- >ARPA: hsgj%vax2.ccs.cornell.edu@cu-arpa.cs.cornell.edu >UUCP: ihnp4!cornell!batcomputer!hsgj BITNET: hsgj@cornella If you go poking around system data structures, you should really use Forbid() and Permit() to keep other processes from changing the data while you're accessing it. get head of device list... Forbid(); while (devinfo != NULL) use devinfo->whatever... Permit(); return result... Although it would be rare for this particular routine to get into trouble (depends on how often you mount new devices, I guess), better safe than sorry... --mic-- ...!ihnp4!ut-sally!ut-ngp!mic mic@ngp.utexas.edu ccep001@utadnx.bitnet