public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* cancelling
@ 2000-07-10  8:55 Thomas Sailer
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Sailer @ 2000-07-10  8:55 UTC (permalink / raw)
  To: pthreads-win32

I'm trying to cancel a thread that is blocking
in pthread_cond_wait. When I do this, I get:
gdb: unknown target exception 0xebaddeed at 0x77e79b01

I'm using the precompiled snapshot 1999-11-02,
the rest of the program is compiled with the current
(as of two weeks ago) cygwin gcc (with -mno-cygwin).

What am I missing?

Tom

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

* Re: cancelling
  2000-07-12 10:25 ` cancelling Thomas Sailer
@ 2000-07-12 23:24   ` Ross Johnson
  0 siblings, 0 replies; 7+ messages in thread
From: Ross Johnson @ 2000-07-12 23:24 UTC (permalink / raw)
  To: Thomas Sailer; +Cc: Bossom, John, pthreads-win32

Thomas Sailer wrote:
> 
> The code currently seems to support three mechanisms:
> 
> if _MSC_VER is defined, it seems to be using SEH.
> 
> otherwise, if __cplusplus is defined, it seems to
> be using C++ EH.
> 
> otherwise, it just starts the thread without any
> exception handling.
> 
> Now the question is how the precompiled
> DLL on the net was compiled.

The precompiled DLL was built using MSVC and is using SEH.
The C++ EH is in there to support building the library
with the GNU compilers. The third option (ie. build with C
and no EH) perhaps shouldn't be there, although, provided
people are aware of the limitations could be useful to
someone.

Side note: the EH within the DLL should be self-contained
such that an application which uses the library can be
built as standard C without EH and not run into trouble.
At least that is what I've been assuming. I could be wrong.

Ross

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

* Re: cancelling
  2000-07-12  7:34 cancelling Bossom, John
  2000-07-12  8:44 ` cancelling Lorin Hochstein
@ 2000-07-12 10:25 ` Thomas Sailer
  2000-07-12 23:24   ` cancelling Ross Johnson
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Sailer @ 2000-07-12 10:25 UTC (permalink / raw)
  To: Bossom, John; +Cc: pthreads-win32

"Bossom, John" wrote:
> 
> Now, originally I implemented the pthread_cancel mechanism
> with Microsoft's SEH (Structured Exception Handling)
> and internally the BAD DEED is being thrown using this
> mechanism and being caught by the thread start routine.
> 
> You should check to see if someone changed the thread
> start routine to use the C++ exception mechanism.

The code currently seems to support three mechanisms:

if _MSC_VER is defined, it seems to be using SEH.

otherwise, if __cplusplus is defined, it seems to
be using C++ EH.

otherwise, it just starts the thread without any
exception handling.

Now the question is how the precompiled
DLL on the net was compiled.

Tom

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

* Re: cancelling
  2000-07-12  7:34 cancelling Bossom, John
@ 2000-07-12  8:44 ` Lorin Hochstein
  2000-07-12 10:25 ` cancelling Thomas Sailer
  1 sibling, 0 replies; 7+ messages in thread
From: Lorin Hochstein @ 2000-07-12  8:44 UTC (permalink / raw)
  To: pthreads-win32

See the documentation on the "_set_se_translator" function for translating
to SEH to C++ exceptions.

Lorin Hochstein

----- Original Message -----
From: "Bossom, John" <John.Bossom@Cognos.COM>
To: "'Thomas Sailer'" <sailer@ife.ee.ethz.ch>; "Bossom, John"
<John.Bossom@Cognos.COM>
Cc: <pthreads-win32@sourceware.cygnus.com>
Sent: Wednesday, July 12, 2000 10:33 AM
Subject: RE: cancelling


> Now, originally I implemented the pthread_cancel mechanism
> with Microsoft's SEH (Structured Exception Handling)
> and internally the BAD DEED is being thrown using this
> mechanism and being caught by the thread start routine.
>
> You should check to see if someone changed the thread
> start routine to use the C++ exception mechanism.
>
> The drawback of SEH is that it doesn't work well
> with C++ as it bypasses the C++ stack unwinding
> (i.e. calling destructors).
>
> This could be handled by using a hook function that
> maps SEH into C++ exceptions and using C++ exception
> handling in your mainline for your thread. You'll
> have to do some reading on providing the hook in
> the Microsoft documentation. (I haven't done this
> but it seems like a good theory anyway ;^)
>
> John.
>
> -----Original Message-----
> From: Thomas Sailer [ mailto:sailer@ife.ee.ethz.ch ]
> Sent: Wednesday, July 12, 2000 7:21 AM
> To: Bossom, John
> Cc: pthreads-win32@sourceware.cygnus.com
> Subject: Re: cancelling
>
>
> "Bossom, John" wrote:
>
> > Check to see if the code base for pthread is wrapping
> > an exception handler around your thread mainline
> > (the original code had an internal routine called "threadStart"
> > which used Microsoft's Structured Exception Handling for catching all
> > exceptions raised in your thread.)
>
> The thread I'm trying to cancel was created with pthread_create,
> and internally the thread routine is started through
> _pthread_threadStart, which should be fine.
>
> The thread that tries to cancel is the initial thread, i.e.
> the one that called _main.
>
> > Now, your thread is recognizing the cancel (the exception
> > hex value is human readable: BAD DEED) and should have
>
> I thought that the constant wasn't chosen arbitrarily :))
>
> Tom

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

* RE: cancelling
@ 2000-07-12  7:34 Bossom, John
  2000-07-12  8:44 ` cancelling Lorin Hochstein
  2000-07-12 10:25 ` cancelling Thomas Sailer
  0 siblings, 2 replies; 7+ messages in thread
From: Bossom, John @ 2000-07-12  7:34 UTC (permalink / raw)
  To: 'Thomas Sailer', Bossom, John; +Cc: pthreads-win32

Now, originally I implemented the pthread_cancel mechanism
with Microsoft's SEH (Structured Exception Handling)
and internally the BAD DEED is being thrown using this
mechanism and being caught by the thread start routine.

You should check to see if someone changed the thread
start routine to use the C++ exception mechanism.

The drawback of SEH is that it doesn't work well
with C++ as it bypasses the C++ stack unwinding
(i.e. calling destructors).

This could be handled by using a hook function that
maps SEH into C++ exceptions and using C++ exception
handling in your mainline for your thread. You'll
have to do some reading on providing the hook in
the Microsoft documentation. (I haven't done this
but it seems like a good theory anyway ;^)

John.

-----Original Message-----
From: Thomas Sailer [ mailto:sailer@ife.ee.ethz.ch ]
Sent: Wednesday, July 12, 2000 7:21 AM
To: Bossom, John
Cc: pthreads-win32@sourceware.cygnus.com
Subject: Re: cancelling


"Bossom, John" wrote:

> Check to see if the code base for pthread is wrapping
> an exception handler around your thread mainline
> (the original code had an internal routine called "threadStart"
> which used Microsoft's Structured Exception Handling for catching all
> exceptions raised in your thread.)

The thread I'm trying to cancel was created with pthread_create,
and internally the thread routine is started through
_pthread_threadStart, which should be fine.

The thread that tries to cancel is the initial thread, i.e.
the one that called _main.

> Now, your thread is recognizing the cancel (the exception
> hex value is human readable: BAD DEED) and should have

I thought that the constant wasn't chosen arbitrarily :))

Tom

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

* Re: cancelling
  2000-07-10  9:35 cancelling Bossom, John
@ 2000-07-12  4:21 ` Thomas Sailer
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Sailer @ 2000-07-12  4:21 UTC (permalink / raw)
  To: Bossom, John; +Cc: pthreads-win32

"Bossom, John" wrote:

> Check to see if the code base for pthread is wrapping
> an exception handler around your thread mainline
> (the original code had an internal routine called "threadStart"
> which used Microsoft's Structured Exception Handling for catching all
> exceptions raised in your thread.)

The thread I'm trying to cancel was created with pthread_create,
and internally the thread routine is started through
_pthread_threadStart, which should be fine.

The thread that tries to cancel is the initial thread, i.e.
the one that called _main.

> Now, your thread is recognizing the cancel (the exception
> hex value is human readable: BAD DEED) and should have

I thought that the constant wasn't chosen arbitrarily :))

Tom

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

* RE: cancelling
@ 2000-07-10  9:35 Bossom, John
  2000-07-12  4:21 ` cancelling Thomas Sailer
  0 siblings, 1 reply; 7+ messages in thread
From: Bossom, John @ 2000-07-10  9:35 UTC (permalink / raw)
  To: 'Thomas Sailer', pthreads-win32

Check to see if the code base for pthread is wrapping
an exception handler around your thread mainline
(the original code had an internal routine called "threadStart"
which used Microsoft's Structured Exception Handling for catching all
exceptions raised in your thread.)
The cancel mechanism was implemented using this strategy.
Now, your thread is recognizing the cancel (the exception
hex value is human readable: BAD DEED) and should have
been caught by the threadStart wrapper, which would have
gracefully shut down your thread.

I am not familiar with the code base anymore so you will
have to ask others... ie Ross

-----Original Message-----
From: Thomas Sailer [ mailto:sailer@ife.ee.ethz.ch ]
Sent: Monday, July 10, 2000 11:55 AM
To: pthreads-win32@sourceware.cygnus.com
Subject: cancelling


I'm trying to cancel a thread that is blocking
in pthread_cond_wait. When I do this, I get:
gdb: unknown target exception 0xebaddeed at 0x77e79b01

I'm using the precompiled snapshot 1999-11-02,
the rest of the program is compiled with the current
(as of two weeks ago) cygwin gcc (with -mno-cygwin).

What am I missing?

Tom

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

end of thread, other threads:[~2000-07-12 23:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-10  8:55 cancelling Thomas Sailer
2000-07-10  9:35 cancelling Bossom, John
2000-07-12  4:21 ` cancelling Thomas Sailer
2000-07-12  7:34 cancelling Bossom, John
2000-07-12  8:44 ` cancelling Lorin Hochstein
2000-07-12 10:25 ` cancelling Thomas Sailer
2000-07-12 23:24   ` cancelling Ross Johnson

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).