public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* __lock_try_acquire() and __lock_try_acquire_recursive() return value?
@ 2017-04-07 20:36 Freddie Chopin
  0 siblings, 0 replies; only message in thread
From: Freddie Chopin @ 2017-04-07 20:36 UTC (permalink / raw)
  To: newlib

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-07 20:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 20:36 __lock_try_acquire() and __lock_try_acquire_recursive() return value? Freddie Chopin

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 read-only IMAP folder(s) and NNTP newsgroup(s).