This is the mail archive of the cygwin-developers@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]

RE: System-wide mutexes and pthreads



> -----Original Message-----
> From: cygwin-developers-owner@cygwin.com 
> [mailto:cygwin-developers-owner@cygwin.com] On Behalf Of Conrad Scott
> Sent: Thursday, 13 June 2002 4:28 AM
> To: cygwin-developers@cygwin.com; cygwin-developers@cygwin.com
> Subject: System-wide mutexes and pthreads
> 
> 
> Looking at the current pthread implementation on cygwin, it 
> seems that it
> doesn't support any system-wide synchronization mechanisms 
> (i.e. none of the
> synchronization primitives allow PTHREAD_PROCESS_SHARED and 
> there are no
> named semaphores). Before I go and use win32 semaphores in 
> the cygserver, is
> there something I'm missing?

You're missing nothing, but I can help a little here:

Cygserver coding guidelines:
1) Trust nothing. Don't trust Process ID's, access rights or anything
else. Always check via an alternate path if you are able to. 
2) Use pure win32 code wherever possible. I used pthread_once because I
could :}, but other than that you'll find it's all native objects. The
only other big exception being using domain sockets, and that's because
they are so dang useful for LPC.
3) The cygserver needs to be robust. It should never need to wait on a
user owned mutex or event, and if it absolutely has to wait on such a
thing should always use a timed wait call.
4) Latency. Try to get the most bang for each cygserver LPC call. It's
better to spend a few cycles setting up several parameters than to wear
the overhead of (say) access checks multiple times.

Hope that helps,
Rob


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