From: Stephen Hemminger <stephen@networkplumber.org>
To: Ziyang Xuan <xuanziyang2@huawei.com>
Cc: <dev@dpdk.org>, <ferruh.yigit@intel.com>,
<cloud.wangxiaoyun@huawei.com>, <luoxianjun@huawei.com>,
<tanya.brokhman@huawei.com>
Subject: Re: [dpdk-dev] [PATCH v1 1/1] net/hinic: use mutex replace spin lock
Date: Wed, 3 Jul 2019 08:37:17 -0700 [thread overview]
Message-ID: <20190703083717.6c5a7eae@hermes.lan> (raw)
In-Reply-To: <1562168142-219415-1-git-send-email-xuanziyang2@huawei.com>
On Wed, 3 Jul 2019 23:35:42 +0800
Ziyang Xuan <xuanziyang2@huawei.com> wrote:
>
> +static inline int hinic_mutex_init(pthread_mutex_t *pthreadmutex,
> + const pthread_mutexattr_t *mattr)
> +{
> + int err;
> +
> + err = pthread_mutex_init(pthreadmutex, mattr);
> + if (unlikely(err))
> + PMD_DRV_LOG(ERR, "Fail to initialize mutex, error: %d", err);
> +
> + return err;
> +}
> +
> +static inline int hinic_mutex_destroy(pthread_mutex_t *pthreadmutex)
> +{
> + int err;
> +
> + err = pthread_mutex_destroy(pthreadmutex);
> + if (unlikely(err))
> + PMD_DRV_LOG(ERR, "Fail to destroy mutex, error: %d", err);
> +
> + return err;
> +}
> +
I don't think the wrapper functions add much.
pthread_mutex_init just sets internals of data structure and won't fail ever
if mutexattr_t is NULL.
Just use pthread_mutex_init/pthread_mutex_destroy directly
and ignore errors.
next prev parent reply other threads:[~2019-07-03 15:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 15:35 Ziyang Xuan
2019-07-03 15:37 ` Stephen Hemminger [this message]
2019-07-09 12:14 Xuanziyang (William, Chip Application Design Logic and Hardware Development Dept IT_Products & Solutions)
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=20190703083717.6c5a7eae@hermes.lan \
--to=stephen@networkplumber.org \
--cc=cloud.wangxiaoyun@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=luoxianjun@huawei.com \
--cc=tanya.brokhman@huawei.com \
--cc=xuanziyang2@huawei.com \
/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 NNTP newsgroup(s).