[comp.sys.amiga] Libraries

page@ulowell.cs.ulowell.edu (Bob Page) (04/19/87)

hadeishi@husc7.UUCP (Mitsuharu Hadeishi) wrote in article <1679@husc6.UUCP>:
>	Something that should be remembered is that all library code
>MUST be reentrant, so multiple tasks can use it at once.
 ^^^^
Yes and no ... IF you want it to be used by multiple tasks, it must be
reentrant.  If you want to write a library that can only be used by one
task at a time, just watch the Usage count and refuse to allow more
than one process from having it at any one time.

Some applications 'share' common code, but don't necessarily get run
at the same time (different paint programs, different programs that
use the serial port, etc).  Note this is VERY similar to an exclusive
device, although with a library you're not controlling a 'device'
per se ... it's just common code.  The only advantage is that your
executables on disk are smaller.

I agree this might not be really useful in most applications, but
just wanted to point out that it IS possible to have non-reentrant
libraries, as long as you know what you're doing.

..Bob
-- 
Bob Page, U of Lowell CS Dept.   page@ulowell.{uucp,edu,csnet}