I would like to create a process that will loop indefinitely (until it is
killed by the parent) updating the title of a window and then sleeping for
a minute while the parent process waits for intuition messages. Only problem
is that everytime I try to create the process, it crashes the machine on me.
My taglist consists of an NP_Entry to a function of mine (I figured the
defaults were fine).
Is it possible for the two processes to share global variables? (ie a
pointer to a window) Is there a better way to handle intuition input
while doing other things (without busy waiting)?
Someone posted earlier that subprocesses must open the libraries they use
themselves and the RKM's state explicitly that processes cannot share library
pointers. Therefore I reopened the two libraries (dos and intuition) I'm
going to need in the function run by the child process.
I may be missing something obvious considering I've only had the RKM's for
about a week... but if anyone has any suggestions for creating processes in
C, please respond. Thanks in advance.
--
___________________________________________________________________________
__
/ /\ Tom Warkentin Internet: Mad%mad....@kakwa.ucs.ualberta.ca
/_/ \ The Spectre BBS UUCP: kakwa.ucs.ualberta.ca!mad!Mad
\ \ / Edmonton, AB
\_\/ (403) 435-9486 The Spectre: 16.8DS, 277megs - call today!
Well, I've wasted another 4 hours trying to figure out how to create a
process using CreateNewProc or CreateNewProcTags. Maybe someone out there
can shed some light on the situation?
I would like to create a process that will loop indefinitely (until it is
killed by the parent) updating the title of a window and then sleeping for
a minute while the parent process waits for intuition messages. Only problem
I think a better method would be to create a timer message and then wait
it signal for you. Something like this,
TimerSigMask = 1 << MyTimerPort->mp_SigBit;
IDCMPSigMask = 1 << MyWindow->UserPort->mp_SigBit;
while(!END) {
Signal = Wait( TimerSigMask | IDCMPSigMask );
if(Signal & TimerSigMask) {
/* ... */
}
else if( Signal & IDCMPSigMask ) {
/* ... */
}
etc....
You of course have to create timer message with timer.device first. And
when you have received the first message, you can set a new one.
> / /\ Tom Warkentin Internet: Mad%mad....@kakwa.ucs.ualberta.ca
--
**************************************************************************
* Markus Aalto | Helsinki University of Technology *
* | *
* EMail: s37...@vipunen.hut.fi | Faculty of Electric Engineering *
* Fax: 358-0-8746991 (Sometimes) | *
* | Undergraduate in Computer Science *
**************************************************************************
** Is it possible for the two processes to share global variables? (ie a
** pointer to a window) Is there a better way to handle intuition input
** while doing other things (without busy waiting)?
Yes. Use the timer.device to make a timer wait for your minute, and instead
of WaitPort()ing on the window's userport, Wait() for a mask built from the
timer's message port signal bit and the window's user port signal bit.
ie: something like this:
mask=timerport->mp_SigBit | window->UserPort->mp_SigBit;
signal=Wait(mask)
if (signal & timerport->mp_SigBit)
/* you've got a timer message */
if (signal & window->UserPort->mp_SigBit)
/* you've got an intuition message */
Remember to reset the timer after every timer message.
If you do this, you only need one process (as much fun as it may be executing
two at once).
+-----------------------------------------------+------------------------+
| Blessed are they who Go Around in Circles, | Neil M.G. Gall |
| for they shall be known as Wheels. | ne...@uk.ac.hw.cee |
+-----------------------------------------------+------------------------+