public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* cancelation problem
@ 1999-11-08  2:20 Erik Hensema
  1999-11-09 17:20 ` Ross Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Hensema @ 1999-11-08  2:20 UTC (permalink / raw)
  To: 'Pthreads-win32'

Hi,

I'm investigating a problem regarding thread cancelation. The thread I want
to cancel has PTHREAD_CANCEL_ASYNCHRONOUS, however, this piece of code
blocks on the join():

		if ((retv = Pthread_cancel( recvThread )) == 0)
		{
			retv = Pthread_join( recvThread, 0 );
		}

Pthread_* are just macro's; they call pthread_*. 

The thread recvThread seems to block on a select() call. It doesn't get
cancelled.

Two questions:

1) is this normal behaviour? 

2) if not, how does the cancel mechanism work? I'm not very familliar to
win32 programming, so I don't really understand how the *Event() family of
calls work.

-- 
Erik Hensema
Work: erik.hensema@group2000.nl
Home: erik@hensema.xs4all.nl

^ permalink raw reply	[flat|nested] 3+ messages in thread
* RE: cancelation problem
@ 1999-11-09 23:41 Erik Hensema
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Hensema @ 1999-11-09 23:41 UTC (permalink / raw)
  To: egcs; +Cc: 'Pthreads-win32'

> -----Original Message-----
> From: Ross Johnson [ mailto:rpj@ise.canberra.edu.au ]

> The thread I want
> > to cancel has PTHREAD_CANCEL_ASYNCHRONOUS, however, this 
> piece of code
> > blocks on the join():
[...]
> > The thread recvThread seems to block on a select() call. It 
> doesn't get
> > cancelled.
>
[...]
> Pthreads-win32 doesn't support asynchronous cancelation, only
> deferred, which is also very limited. The reason there is no async
> cancelation is that it's very hard, if not impossible, to implement
> on top of Win32.

Ok, thank you for your explaination. I have solved the problem by adding a
timeout to the select() call, and looping it infinitely. The thread
cancelation now works as it should.

> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-11-09 23:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-08  2:20 cancelation problem Erik Hensema
1999-11-09 17:20 ` Ross Johnson
1999-11-09 23:41 Erik Hensema

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).