home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!gatech!concert!samba!usenet
- From: Todd_Lewis@unc.edu (Todd M. Lewis)
- Subject: Re: spawning a task with a Delay() in it
- Message-ID: <1993Jan21.160755.23617@samba.oit.unc.edu>
- Sender: usenet@samba.oit.unc.edu
- Nntp-Posting-Host: guitar.oit.unc.edu
- Organization: UNC Office of Information Technology
- References: <1993Jan20.193205@informatik.uni-kl.de>
- Date: Thu, 21 Jan 1993 16:07:55 GMT
- Lines: 51
-
- [Oh brother, not again...]
-
- In article <1993Jan20.193205@informatik.uni-kl.de> c_feck@informatik.uni-kl.de
- (Christop Feck) writes:
- >mks@cbmvax.commodore.com (Michael Sinz) writes:
- >>Remember to open any libraries from the process that will call them.
- >
- >Is it really not allowed to pass e.g. IntuitionBase to another process? Why?
- >If I start a new process which should have (considering SAS C) the __saveds
- >keyword in the process entry to allow access to global variables, how could I
- >leave #?Base out and open them for this process only?
-
- Have each task/process open the libraries it needs. The example
- below lets each task open libraries so that they can share base
- pointers. For most libraries around today OpenLibrary() returns
- the same base pointer for each opener. The code below assumes
- that is the case, but will at least allow your program to
- exit gracefully should that change in the future.
-
- BOOL taskOpenLibrary(char *name, LONG version, void **base)
- {
- void *tmp;
- tmp = OpenLibrary( name, version );
- if ( tmp )
- {
- if ( !*base ) *base = tmp;
- if ( *base != tmp )
- {
- CloseLibrary( tmp );
- return FALSE;
- }
- else return TRUE;
- }
- else return FALSE;
- }
- ...
- if ( !taskOpenLibrary( "intuition.library", 0, &IntuitionBase ) )
- die_gracefully("Libraries, they are a changin'");
-
- >I can't imagine that C= will create libraries which must be opened for each
- >process. Rendering many programs incompatible?
-
- Commodore already says that each task/process must open it's libraries
- for itself. The above example will at least let your programs be
- aware that they have become incompatible. Otherwise, I don't see
- how CreateTask() and friends are of much value for C programs if
- the tasks created need to call library functions.
- --
- _/_/_/ _/ Todd_Lewis@unc.edu You can lead a horse to
- _/ _/ utoddl@guitar.oit.unc.edu Mohammad, but you can't make
- _/ _/_/_/ a mountain drink a mole hill.
-