AcquireResource and ReleaseResource together comprise a package used for sharing/locking a global resource between several processes. For example, this package is used to make sure that the compiler is not run simultaneously by more than one exec, by having the compiler call AcquireResource[$Compiler, "Compiler"] before attempting to run.
If one process) has already acquired (the) resource, an attempt to acquire it by another process will print a suitable message, and cause the process to wait for the resource to be freed, i.e. AcquireResource will not return until the resource is available. However, while waiting for the resource to be available, the user can abort by clicking STOP in the corresponding exec, and AcquireResource will call IO.UserAborted.
Where there is only one instance of a particular resource, resource is typically an atom, e.g. $Compiler, $Bringover, etc. However, resource can be an arbitrary REF ANY, e.g. a stream, viewer, execHandle etc. GetStreams, described above, calls AcquireResource with a stream as the resource. The decision about whether this resource is available or not is made by comparing resource with those that are currently not available, have been acquired but not released, using =.
owner is used to identify who currently owns the resource in the message that is printed when waiting. For example, it is not possible for two commands registered via the old Exec interface to run simultaneously, because there is only one global exec handle. In order to prevent two such commands from executing at the same time, AcquireResource is called with resource = $ExecDotW, and owner = name of the command, so that AcquireResource can print out who it is that owns the resource, e.g. BringOver, SModel, etc. If owner = NIL, no message is printed.
If AcquireResource is called on the same resource from the same process, it is effectively a NOP, i.e. the process does not wait. This enables an application not to have to keep track of whether or not it has already acquired the resource at some other level. However, it is necessary that each AcquireResource be matched by a corresponding ReleaseResource: the resource will not actually be freed until a ReleaseResource has been done for each AcquireResource.