tis_mutex_trylock(3) Library Functions Manual tis_mutex_trylock(3)NAME
tis_mutex_trylock - Attempts to lock the specified mutex.
LIBRARY
Standard C Library (libc.so, libc.a)
SYNOPSIS
#include <tis.h>
int tis_mutex_trylock(
pthread_mutex_t *mutex);
STANDARDS
None
PARAMETERS
Address of the mutex (passed by reference) to be locked.
DESCRIPTION
This routine attempts to lock the specified mutex mutex. When this routine is called, an attempt is made immediately to lock the mutex.
If the mutex is successfully locked, zero (0) is returned.
If the specified mutex is already locked when this routine is called, the caller does not wait for the mutex to become available. [EBUSY]
is returned, and the thread does not wait to acquire the lock.
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The mutex is already locked; therefore, it was not acquired. The value specified by mutex is invalid.
ERRORS
None
RELATED INFORMATION
Functions: tis_mutex_destroy(3), tis_mutex_init(3), tis_mutex_lock(3), tis_mutex_unlock(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
tis_mutex_trylock(3)
Check Out this Related Man Page
pthread_mutex_trylock(3) Library Functions Manual pthread_mutex_trylock(3)NAME
pthread_mutex_trylock - Attempts to lock the specified mutex, without waiting if already locked.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_mutex_trylock(
pthread_mutex_t *mutex);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
PARAMETERS
Mutex to be locked.
DESCRIPTION
This routine attempts to lock the mutex specified in the mutex argument. When a thread calls this routine, an attempt is made to immedi-
ately lock the mutex. If the mutex is successfully locked, this routine returns zero (0) and the calling thread becomes the mutex's current
owner. If the specified mutex is locked when a thread calls this routine, the calling thread does not wait for the mutex to become avail-
able.
The behavior of this routine is as follows: For a normal, default, or errorcheck mutex: if the mutex is locked by any thread (including the
calling thread) when this routine is called, this routine returns [EBUSY] and the calling thread does not wait to acquire the lock. For a
normal or errorcheck mutex: if the mutex is not owned, this routine returns zero (0) and the mutex becomes locked by the calling thread.
For a recursive mutex: if the mutex is owned by the calling thread, this routine returns zero (0) and the mutex lock count is incremented.
(To unlock a recursive mutex, each call to pthread_mutex_trylock(3) must be matched by a call to pthread_mutex_unlock(3).)
Use the pthread_mutexattr_settype(3) routine to set the mutex type attribute (normal, default, recursive, or errorcheck).
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The mutex is already locked; therefore, it was not acquired. The value specified by mutex is not a valid mutex.
ERRORS
None
RELATED INFORMATION
Functions: pthread_mutexattr_settype(3), pthread_mutex_destroy(3), pthread_mutex_init(3), pthread_mutex_lock(3), pthread_mutex_unlock(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_mutex_trylock(3)
Hi,
I want to do the foll steps:
1. Check if someone has a lock on my file1.
2. if file1 is locked by any other user
wait in a loop till another user releases lock
3. when lock released, lock file1.
4. do procesing (write) on file1.
5. processing complete. release lock on file1.
... (2 Replies)
I have some locked files ( locked via the Mac finder)
I have tired rm -R and rm -rdf but it doesnt delete the locked files
just says "override rw------- etc?"
type "yes" and says "operation not permitted"
is there some way to do this (or unlock the files)
Thanks (1 Reply)
Hi, I have two tasks 'Read' and 'Write' which reads and writes on a file "abc.txt" respectively.
Now I need to restrict the Write operation on the file while Read is going on, But can allow two Reads at a time.
ie. two Reads can happen simultaneously, but Write can't happen at Read is going on.
... (3 Replies)
Hi Everyone
I have this quite simple "tread" function
void* row_calc(void *input)
{
struct thread_arg* th_arg;
th_arg=(struct thread_arg *) input;
int start,width,end,seg,k,l,tmp;
start=th_arg->start;
width=th_arg->width;
end=start+width-1;
seg=th_arg->seg;
... (2 Replies)
Hi,
How to list the files which are not locked?
I want to read the files that are not locked by other user only.
can we do it using ls option? (5 Replies)
Hi everyone,
I have got a requirement that, i need to check a specific folder,say /test/lock/ for few specific files, say *lock*, whether it has been locked or not.If any one of it is locked than i need to delete that file after a specific time, say after 10 minutes.
I never have worked on... (4 Replies)
Hi all,
I have a scenario where I need to use the mutex locks. The mutex locks are working fine, but sometimes I am getting into the dead lock situation.
Below is the summary of my code :
MUTEX LOCK
performTask();
MUTEX UNLOCK.
In some cases I get into the situation where... (2 Replies)