Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!prism!roy From: roy@prism.gatech.EDU (Roy Mongiovi) Newsgroups: comp.sys.next Subject: How do you use threads from an objective-c program? Message-ID: <387@hydra.gatech.EDU> Date: 3 Apr 89 15:56:52 GMT Distribution: usa Organization: Georgia Institute of Technology Lines: 35 As a recent owner of a NeXT machine and having just received my copy of the technical doc, I wanted to write a simple program to use the interface builder and display postscript to do some graphics on the beast. I rewrote a simple program I've played with since I first learned to program. It uses vector addition to draw a "spirograph." Despite having to learn objective-c and fighting with the idiosyncracies of the interface builder, I got it working in a couple of days. Unfortunately, it has one problem. Once the "draw" method of the spirograph has been invoked, the application is busy until the entire spirograph is drawn. In particular, my "stop" key waits until much too late to do anything. Ahah! I thought. This sounds like a job for threads. So I hacked up the code so that the main drawing loop is a separate function and ran it in another thread. Imagine my surprise when the window server complained that the client connection had closed prematurely and then bombed out. It's repeatable. It draws a spirograph apparently up until the postscript commands get flushed, and then bombs out the window server. Is it something I said? Or am I just doing something incorrectly? This seems like the sort of thing an application might want to do alot of: updating a window while allowing changes to the application's parameters. Can someone tell me what I did wrong or what the right way is to do this? Just point me in the right direction.... Thanks. -- Roy J. Mongiovi Systems Support Specialist Office of Computing Services Georgia Institute of Technology Atlanta, Georgia 30332-0275 (404) 894-4660 uucp: ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!roy ARPA: roy@prism.gatech.edu