On Tue, Mar 30, 2004 at 03:55:14PM +0200, Corinna Vinschen wrote: >On Mar 30 15:34, Thomas Pfaff wrote: >> Regardless whether a process is started from a cygwin app or not it will >> always start at mainCRTStartup. >> >> When it is started by the SCM however the service_main thread is created by >> the SCM. The situation is similar to calling CreateThread instead of >> pthread_create. The thread will be handled as anonymous since it is not in the >> thread >> list and has not been initialized in thread_init_wrapper. > >Yeah, I just realized this while in the shower. > >> I think the easiest way is to modify pthread::init_mainthread in a way that >> it handles such a situation properly and will keep the pthread_self pointer >> unchanged after a fork. > >Do you have an appropriate patch? > >> But you can also change cygrunsrv to create a thread via pthread_create and >> fork from this thread. This should work either. > >That's not the way to go, IMO. It requires *all* Cygwin applications >written to be started under SCM to be rewritten.
Right. I've been working hard to keep cygwin functional with cygrunsrv and SCM. In fact, I think I've removed the requirement that inetd has to fork a process after it calls SCM so that signals are delivered properly. Since this is a breaking of backwards compatibility we won't even consider changing applications. I've read the rest of the thread and know that there is a patch ready but I wanted to get these thoughts into the archive. cgf
