public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Freddie Chopin <freddie_chopin@op.pl>
To: newlib <newlib@sourceware.org>
Subject: __lock_try_acquire() and __lock_try_acquire_recursive() return value?
Date: Fri, 07 Apr 2017 20:36:00 -0000	[thread overview]
Message-ID: <1491597367.12860.1.camel@op.pl> (raw)

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

                 reply	other threads:[~2017-04-07 20:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491597367.12860.1.camel@op.pl \
    --to=freddie_chopin@op.pl \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).