Article View: comp.sys.next.programmer
Article #1725Re: help with concurrent threads
From: andrew
Date: Fri, 02 Oct 1992 18:50
Date: Fri, 02 Oct 1992 18:50
31 lines
1780 bytes
1780 bytes
In article <1992Sep30.130539.12174@ghost.dsi.unimi.it> rizzi@ghost.dsi.unimi.it (daniele rizzi) writes:
>
>
>Hi all,
>I'm trying to build an application with two concurrent c_threads, the former
> managing the windows, the latter working with the DSP56.
>I would like that the secondary thread shows the result of its computation
>to the main window, so in the 'c' code I have inserted the method:
>
>[form setIntValue:the_result];
>
>at runtime, sometimes the program crashes with 'Unlock the Wrong View' message
>and various DPS-errors. Why?
Doing anything with the windowserver from any thread other than the
main one can cause weird things to happen --- only send messages to
AppKit objects and do things with the windowserver from the main
thread.
A solution is to either use conditions or muticies to signal the
main-thread that it's time to display a certain shared variable or
pass mach-messages to the main thread. Check out the Sorting in
Action miniexample for details on using speaker-listener.
andrew
--
andrew@cubetech.com | "We shall not cease from exploration
Andrew Loewenstern | And the end of our exploring
Cube Technologies, Inc. | Will be to arrive where we started
| And know the place for the first time." -T.S. Eliot
Technical Details
Message-ID:
<1992Oct2.185004.333@cubetech.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!kithrup!stanford.edu!agate!spool.mu.edu!think.com!rpi!newsserver.pixel.kodak.com!psinntp!psinntp!cubetech.com!imladris!andrewReferences:
<1992Sep30.130539.12174@ghost.dsi.unimi.it>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!stanford.edu!agate!spool.mu.edu!think.com!rpi!newsserver.pixel.kodak.com!psinntp!psinntp!cubetech.com!imladris!andrew From: andrew@cubetech.com Subject: Re: help with concurrent threads Message-ID: <1992Oct2.185004.333@cubetech.com> Keywords: threads Organization: Cube Technologies, Inc. References: <1992Sep30.130539.12174@ghost.dsi.unimi.it> Date: Fri, 2 Oct 1992 18:50:04 GMT Lines: 31