From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117153 invoked by alias); 7 Apr 2017 20:36:16 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 117134 invoked by uid 89); 7 Apr 2017 20:36:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1005, H*F:D*op.pl, H*F:D*pl, wondering X-HELO: smtpo49.poczta.onet.pl Received: from smtpo49.poczta.onet.pl (HELO smtpo49.poczta.onet.pl) (213.180.142.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 07 Apr 2017 20:36:12 +0000 Received: from [192.168.2.253] (213-238-94-101.adsl.inetia.pl [213.238.94.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: freddie_chopin@op.pl) by smtp.poczta.onet.pl (Onet) with ESMTPSA id 3w0BDm5h2Jzx31hL for ; Fri, 7 Apr 2017 22:36:08 +0200 (CEST) Message-ID: <1491597367.12860.1.camel@op.pl> Subject: __lock_try_acquire() and __lock_try_acquire_recursive() return value? From: Freddie Chopin To: newlib Date: Fri, 07 Apr 2017 20:36:00 -0000 Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00284.txt.bz2 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