Re: (no subject)



The stop=TRUE/FALSE may do the trick, I'll try it. The problem I think is
that while the hard working thread is running, I can't even click the STOP
button. It seems that the working thread never releases the CPU, or rather 
the drawing thread never gets the CPU. It's like in Win98, when an
application is busy, the GUI doesn't take any commands.



On Tue, 12 Dec 2000, Paul Barton-Davis wrote:

> pthread_cancel() only has an effect when a thread encounters a
> "cancellation point". for example, if it was executing:
> 
> 	      while (1);
> 

It will, in the real application. For now I just didn't want it to hang
forever in case something went wrong. 
> 

> You can't expect pthread_cancel() to work the way that kill(2) works
> on processes.

What's pthread_cancel() for then? I'll have to read the man page more
carefully.

> void
> stop_thread ()
> 
> {
> 	void *status;
> 	stop = true;
> 	/* now wait till the thread has exited */
> 	pthread_join (thread, &status);
> 	printf ("thread exited with status %d\n", *((int *) status));
> }
> 

So this can be called directly from the handler of the STOP button, right?


Thanks for the suggestions.







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]