pthreads works, sorta
Tue Jun 26 22:58:00 GMT 2001
> -----Original Message-----
> From: Dmitry Timoshkov [ mailto:email@example.com ]
> Sent: Wednesday, June 27, 2001 4:51 PM
> To: Robert Collins; Greg Smith; firstname.lastname@example.org
> Subject: Re: pthreads works, sorta
> "Robert Collins" <email@example.com> wrote:
> > What does all this mean? We need to catch invalid memroy access, and
> > ValidQuery was supplied by Chris as a tool to do that.
> In a multithreaded environment VirtualQuery, IsBad* and
> similar approaches
> are wrong. It can't be guaranteed that after a successful
> test that memory
> will be still accessable.
It's kernel allocated memory we are checking against (the user cannot
free it from under us). The function does the following:
check the pointer is not null
check the pointer is into mapped address space.
check the type of the structure it's pointing into is correct (ie a
The main reason for the readable address check is to prevent the process
hanging because a signal is generated in cygwin's pthread code due to
bad userland variable values (threads are used to handle signals and
thus signals from the pthreads code never gets processed). The race
protection is dealt with (not completely yet) elsewhere.
I agree with the principle that you describe however.
> > So the question for all the win32 gurus:
> > Whats a fast way to catch (in-cygwin-dll) invalid memory
> access's. Can
> > we use structed exception handling there? Or...?
> Using SEH is probably a way to go.
SEH uses pthreads in multithreaded applications. Will SEH work reliably
in the pthreads code?
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
More information about the Cygwin