caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Mutex and posix
@ 2005-01-12 10:53 Luca Pascali
  2005-01-12 15:56 ` [Caml-list] " Xavier Leroy
  2005-01-15 17:49 ` Alex Baretta
  0 siblings, 2 replies; 10+ messages in thread
From: Luca Pascali @ 2005-01-12 10:53 UTC (permalink / raw)
  To: caml-list

Just a little question, my curiosity about the thread module.

I found in Posix (this is from 'info libc' page on section Mutexes) 
these three functions

Function: int pthread_mutex_lock (pthread_mutex_t *mutex))
Function: int pthread_mutex_trylock (pthread_mutex_t *MUTEX)
Function: int pthread_mutex_timedlock (pthread_mutex_t *MUTEX, const 
struct timespec *ABSTIME)

1) for waiting indefinetly for a mutex,
2) failing immediatly if a mutex is locked,
3) wait for a specified amount of time and failing if mutex is still 
locked when time is expired

Module Mutex, provides an interface only to the first two functions: 
lock and try_lock.

My question is:
is there any reason for this situation?

Polling continously is different. If I have two threads that are running 
with scantimes one multiple of the other, it is possible that one of the 
two threads (the slower one) fails always or almost always the try_lock 
command.

Luca

-- 
*********************************************************************
Luca Pascali
luca@barettadeit.com
asxcaml-guru@barettadeit.com

http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. 02 370 111 55
fax. 02 370 111 54

Our technology:
http://www.asxcaml.org/
http://www.freerp.org/


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

end of thread, other threads:[~2005-01-19  9:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-12 10:53 Mutex and posix Luca Pascali
2005-01-12 15:56 ` [Caml-list] " Xavier Leroy
2005-01-12 17:29   ` Luca Pascali
2005-01-15 17:53     ` Alex Baretta
2005-01-15 17:49 ` Alex Baretta
2005-01-15 19:37   ` Brian Hurt
2005-01-17  8:52     ` Alex Baretta
2005-01-19  3:31       ` Brian Hurt
2005-01-19  9:34         ` Alex Baretta
2005-01-17 12:33   ` Luca Pascali

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).