[PATCH] pthread_fork

Thomas Pfaff tpfaff@gmx.net
Fri Aug 16 01:37:00 GMT 2002

On Fri, 16 Aug 2002, Robert Collins wrote:

> On Fri, 2002-08-16 at 04:27, Thomas Pfaff wrote:
> >
> > This patch will fix the pthread key related problems with fork (key value
> > is restored after fork) and some minor fork related fixes.
> Thomas, Some feedback on this. (I know, less than a week - wow!)
> Some general things:
> MTinterface::init_pthread is breaking encapsulation of pthread, please
> correct this.

Agreed. First it was used only in MTinterface but then i discovered that
it would make sense in pthread_self too if the thread has been created
outside the pthread scope.

> You have moved more class specific code in to MTinterface. This further
> breaks abstraction FWICS. Can you enlarge on your reasons for that?

Aside from init_pthread i do not see any code that breaks abstraction. You
have decided to handle the mutex and conds lists in MTinterface, i did the
same with keys. I do not think that handling key destructors requires its
own class and list if you have already a list with all keys.

> Finally it seems to me that the pthread_before_fork new call could
> (should) be called from pthread_atfork_prepare.


> This is a rather big patch, covering several different things -
> refactoring list code, altering initialisation of pthread classes,
> handling fork better for pthreads, handling fork for pthead_key's. I'd
> really like to see it as as series of smaller patches to debate more
> specifcally.

I will try to break the patch into smaller ones. I am just looking where
to start.


More information about the Cygwin-patches mailing list