[comp.sys.next] cthreads and modals

dwatola@NEXTASY2.EECS.WSU.EDU (09/22/90)

I am having problems implementing a short program using the cthreads
package.  My program is a front-end to a circuit simulation package; it
accepts simulation parameters from a NeXT-style window and creates a
command line that is passes to system().  This is done in a method which is
cthread_detach(cthread_fork())'ed from the main code.  My hope was to
have this thread run the simulator in the background, then raise an alert
panel when it had finished.

Unfortunately, upon calling NXRunAlertPanel(), i get the error message
"Exception handlers were not properly removed," often followed by
"Attempt to remove unrecognized exception handler."  The program crashes,
usually leaving my application's window on the screen but removing the
icon, menu, and disabling the event loop.  Other times, though, it simply
eats CPU time.

This program works fine if I remove the NXRunAlertPanel() call.  So my question
is, is there some reason why the modal alert panel should not work from an
inferior thread?  Anyone out there got any ideas or educated guesses?

Thanks.

dave watola                        "Lucretia, my reflection, dance the ghost
dwatola@eecs.wsu.edu                with me..."
dwatola@nextasy2.eecs.wsu.edu                   - A. Eldritch

Eric.Thayer@cs.cmu.edu (Eric H. Thayer) (09/24/90)

In article <9009220547.AA16749@nextasy2.eecs.wsu.edu> 
dwatola@NEXTASY2.EECS.WSU.EDU writes:
> This program works fine if I remove the NXRunAlertPanel() call.  So my 
question
> is, is there some reason why the modal alert panel should not work from 
an
> inferior thread?  Anyone out there got any ideas or educated guesses?

The NeXTStep expects that all display updates will be a result of some 
event.  So, if you go an generate a display update outside of the 
processing of an event, things tend to go haywire in a hurry.   One way to 
approach this problem is to create a new speaker object and connect it to 
the applications listener.  You can then implement an remote method  which 
brings up an alert panel.  It's a little perverse, but up to this point, I 
have not seen a good solution to the problem.

Hope this helps

----------------------------------
Replies can have NeXT attachments in them
Phone: (412)268-7679