Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!fred.cs.washington.edu!wjs From: wjs@fred.cs.washington.edu (William Shipley) Newsgroups: comp.sys.next Subject: Re: Can an App launch itself? Message-ID: <12194@june.cs.washington.edu> Date: 8 Jun 90 13:19:00 GMT References: <11277@sdcc6.ucsd.edu> Sender: news@cs.washington.edu Reply-To: wjs@fred.cs.washington.edu (William Shipley) Distribution: usa Organization: University of Washington Computer Science Lines: 40 Summary: Yes mostly. In article <11277@sdcc6.ucsd.edu> cs171faj@sdcc8.ucsd.edu writes: >Let's say you have an app running; can you make a certain >button create another copy of the app that has the same >functionality as the original (i.e. looks the same, with >all buttons and things functioning)? > >jeff beck If all you want is a brand-new, pristine copy of your app running, you ought to be able to do a system("open myApp") or some such. (You could fork and exec, if you wish). There's a global variable or function that will give you the path in which your app resides, if you don't expect it to be in the normal places. However, if you want your variables to be inherited, it's a little trickier. The Application class isn't re-entrant, that is, you can't have more than one instance of the Application class in any given process. This is a Major Bummer, because it means you can't create a bunch of cthreads, all with different Application objects. What would be the advantage to this, you ask? Well, you could change NXHost for each Application object, so that a single process could support multiple windows on multiple NeXTs. This would be totally keen for multi-player game design, but there are myriad other applications, including courseware. One fix is that you CAN do is many normal forks (which mark memory for the child as copy-on-write, meaning they are memory efficient) BEFORE you ever create any Application object. (This involves rewriting the IB-provided main.m so that you fork before you do the NXApp = [Application new];). Each process can then have its own Application object running. "What do you win?" you are asking. If, before you fork, you mark some pages as SHARED, then you can have shared memory between the Applications, which is sometimes more convienient than messaging. This all sounds complicated and hypothetical, but I've actually tried it, and I'll send anyone (ugly) code on request. -william "please NeXT make your classes re-entrant" shipley ObSilliness: THE Jeff Beck? No kidding. How's the band?