linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Mutual exclusion
@ 2002-06-09 16:05 chuckw
  2002-06-09 17:46 ` Steven Smith
  0 siblings, 1 reply; 4+ messages in thread
From: chuckw @ 2002-06-09 16:05 UTC (permalink / raw)
  To: linux-c-programming

Hello All,
	What are the different types of Mutual exclusion primitives available
in linux?  I know there is the pthread mutex and semaphores.  Is there
anything else?

Thanks Much,
Chuck

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Mutual exclusion
  2002-06-09 16:05 Mutual exclusion chuckw
@ 2002-06-09 17:46 ` Steven Smith
  2002-06-10 21:47   ` Detecting file changes? Christopher Quinn
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Smith @ 2002-06-09 17:46 UTC (permalink / raw)
  To: linux-c-programming

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]

> 	What are the different types of Mutual exclusion primitives available
> in linux?  I know there is the pthread mutex and semaphores.  Is there
> anything else?
Off of the top of my head:

1) pthreads spinlocks
2) pthreads barriers
3) pthreads conditional variables
4) pthreads rwlocks
5) SysV semaphore sets
6) SysV message queues
7) fcntl file locks
8) flock file locks
9) You could probably do something with signals as well, if you're careful
10) Or with a load of pipes and suitable ingenuity
11) link() and the dnotify API, if you're feeling somewhat silly
12) flockfile()

These require varying degrees of cleverness to use, and the best one
(as always) depends on what you're using it for. There are probably
more if you look hard enough, as well.

Unless you have somewhat unusual needs, it's probably easiest to
stick to pthreads mutexs and semaphores.

Steven Smith,
sos22@cam.ac.uk.

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Detecting file changes?
  2002-06-09 17:46 ` Steven Smith
@ 2002-06-10 21:47   ` Christopher Quinn
  2002-06-10 21:50     ` Billy O'Connor
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Quinn @ 2002-06-10 21:47 UTC (permalink / raw)
  To: linux-c-programming

Hello list.

Is there a way other than polling to detect when a file's contents change?
I was hoping something like select(2).
Any ideas?

Thanks,
Chris


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Detecting file changes?
  2002-06-10 21:47   ` Detecting file changes? Christopher Quinn
@ 2002-06-10 21:50     ` Billy O'Connor
  0 siblings, 0 replies; 4+ messages in thread
From: Billy O'Connor @ 2002-06-10 21:50 UTC (permalink / raw)
  To: cq; +Cc: linux-c-programming

   >From billy  Mon Jun 10 16:51:33 2002
   Date:	Mon, 10 Jun 2002 22:47:21 +0100
   From: Christopher Quinn <cq@htec.demon.co.uk>
   X-Accept-Language: en-us, en
   Sender: linux-c-programming-owner@vger.kernel.org
   X-Mailing-List:	linux-c-programming@vger.kernel.org

   Hello list.

   Is there a way other than polling to detect when a file's contents change?
   I was hoping something like select(2).
   Any ideas?

   Thanks,
   Chris

   -
   To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
   the body of a message to majordomo@vger.kernel.org
   More majordomo info at  http://vger.kernel.org/majordomo-info.html

Check out sgi_fam.  This uses select to monitor file accesses.  One
source would be:

http://mirror.hiwaay.net/redhat/redhat/redhat-7.3-en/os/i386/SRPMS/fam-2.6.7-6.src.rpm

--
Billy O'Connor

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-06-10 21:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-09 16:05 Mutual exclusion chuckw
2002-06-09 17:46 ` Steven Smith
2002-06-10 21:47   ` Detecting file changes? Christopher Quinn
2002-06-10 21:50     ` Billy O'Connor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).