Browse thread
Mutex and posix
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-01-12 (10:53) |
From: | Luca Pascali <pasckosky2000@y...> |
Subject: | Mutex and posix |
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/