This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Interprocess friendly Semaphores


Hello All,

I have a UNIX application that utilizes fork() and semaphores.

Unfortunately the current Cygwin behaiour is to terminate the child process immediately, because it does not understand PROCESS_SHARED semaphores.

[ thread.cc ]
> pthread_cond::fixup_after_fork ()
> {
> debug_printf ("cond %x in fixup_after_fork", this);
> if (shared != PTHREAD_PROCESS_PRIVATE)
> api_fatal ("doesn't understand PROCESS_SHARED condition
> variables");

I know that windows supports sharing semaphores between processes. The following MSDN node describes it:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/synchro_1a2g.asp

Changing the above code piece and the following will probably fix something. But I do not know the fork() behaviour and I'm sure that more work will be necessary.

Also I do not know how to recompile Cygwin [ ./configure script says:
configure: error: can not find install-sh or install.sh in . ./.. ./../.. ]

Can you help me?

[ thread.cc ]
> /*attr checked in the C call */
> if (attr && attr->pshared == PTHREAD_PROCESS_SHARED)
> {
> // fail
> magic = 0;
> return;
> }
> if (wincap.has_try_enter_critical_section ())
> InitializeCriticalSection (&criticalsection);
> else
> {
> this->win32_obj_id = ::CreateMutex (&sec_none_nih, false, NULL);
> if (!win32_obj_id)
> magic = 0;
> }
> if (!win32_obj_id)
> magic = 0;
> }

PS: I have checked out sources via CVS.


--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]