[comp.sys.amiga.tech] Permit

mcr@julie.UUCP (Michael Richardson) (03/01/90)

  I've been putting together a shared library to deal with the Fidonet outbound
directory (what files to send to what nodes...)

  [The original system used:

      aaaannnn.tLO
          where     aaaa - net in hex
                    nnnn - node in hex,
           t was one of F - normal
                        H - hold (wait for them to call)
                        C - crash (we call them)
                        D - direct (used to mean zone mail hour only, not
                                    really used anymore)

      There are now three more levels of addressing....
    These files are usually refered to as `flo' files, and contained just
  a simple list of files to send with a prefix of '^' for delete afterward,
  and '#' for truncate to zero afterward.]

  My shared library is called flo.library, and the newer versions scan the
outbound directory for you, and maintain all the work in a common set of
lists (it is actually cached --- only the fact that there _is_ work is recorded,
and the first reference causes the file to be read.)
  These lists are all shared and have SignalSemaphores all over the place
to protect things (and still allow one program to add files to a list of
files when the session handler is currently going through the list at its
slow pace...)

  Now, I'd really like to scan the outbound directory when the first person
opens me, (you must be a process to open me. I'm not sure the best way to
assure that you are a process is, I haven't begun to think about that.) but
more importantly, I want to be write everything out when the last program
closes the library (actually, I'd like to do it every time I get closed, just
to be sure...)
  The problem is that the open and close routines are called with task switching
turned off, and AmigaDOS I/O obviously isn't going to work very well. In addition,
even if Wait() (which must be called somewhere down there) is called and causes
an implicit Permit(), will Exec like that? (OpenLibrary() could be called
again! I can protect myself with Semaphores, but...)

  I dumped the idea of doing the I/O in the open/close routines and decided
to settle for freeing up my memory on last close (I also tried it in expunge,
I can't see that it makes a difference though...) and that didn't seem to work
too well either (I'm talking gurus, etc..)  Note: It could very well be a
bug in the program, except that the routines work in other places.

  Do I even have a context when in the library open routine?

  BTW: The stubs, etc.. were created by Ed Hoogerberts' mklib that was posted
at least a year ago. I've had to maintain the interface after the first or
second generation when I needed more members in my library base, etc...

  Email responses would be appreciated --- I'm perpetually at least 100-200
messages behind. (Often far more --- I wonder that my 5 meg spool: doesn't
fill up more often.)


  :!mcr!:
  Michael Richardson
 mcr@julie.UUCP mcr@doe.carleton.ca (play)
 michael@fts1.UUCP (work)   Fido: 1:163/109.10

p.s: I posted RogueStart to alt.sources.amiga. Unfortunately I forgot
the all important roguestar.h file :-)  I also ftp'ed it (with some
binaries) to xanth and left a message to Tad Guy. My roomate has become a
Lattice 5.04 junkie and wants me to port it (there is a lot of compiler
specific code there! I may try and get library source when I get Manx 5.0,
now that they finally sent me my upgrade notice :-)) Hints welcome.