This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
__lock_try_acquire() and __lock_try_acquire_recursive() return value?
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: newlib <newlib at sourceware dot org>
- Date: Fri, 07 Apr 2017 22:36:07 +0200
- Subject: __lock_try_acquire() and __lock_try_acquire_recursive() return value?
- Authentication-results: sourceware.org; auth=none
Hi!
I'm wondering what's the exact meaning of __lock_try_acquire() and
__lock_try_acquire_recursive() return values? What should be returned
when the locking succeeds and what when it fails?
These functions are only used inside Linux port, and the only comment
that suggests the semantics is in lock.h for tirtos
(newlib/libc/sys/tirtos/include/sys/lock.h):
-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --
/* Returns 0 for success and non-zero for failure */
extern int __libc_lock_try_acquire(_LOCK_T *lock);
extern int __libc_lock_try_acquire_recursive(_LOCK_RECURSIVE_T *lock);
...
#define __lock_try_acquire(lock) \
__libc_lock_try_acquire(&(lock))
#define __lock_try_acquire_recursive(lock) \
__libc_lock_try_acquire_recursive(&(lock))
-- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 -- >8 --
Anyone can confirm that this is the expected behaviour of these two
functions?
Regards,
FCh