DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH 1/2] eal: add API that sleeps while waiting for threads
Date: Thu, 11 Oct 2018 13:32:13 -0700	[thread overview]
Message-ID: <20181011133213.2c37a464@xeon-e3> (raw)
In-Reply-To: <20181011195753.4778-1-ferruh.yigit@intel.com>

On Thu, 11 Oct 2018 20:57:52 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> +/*
> + * Wait until a lcore finished its job by sleeping.
> + * Sleep time will be times of 'usec'
> + */
> +int
> +rte_eal_wait_lcore_sleep(unsigned slave_id, size_t usec)
> +{
> +	if (lcore_config[slave_id].state == WAIT)
> +		return 0;
> +
> +	while (lcore_config[slave_id].state != WAIT &&
> +	       lcore_config[slave_id].state != FINISHED)
> +			usleep(usec);
> +
> +	rte_rmb();
> +
> +	/* we are in finished state, go to wait state */
> +	lcore_config[slave_id].state = WAIT;
> +	return lcore_config[slave_id].ret;
> +}
> +

Since lcore threads are really pthreads you could avoid doing polling by
using a pthread condition (ie. pthread_cond_wait and/or pthread_cond_timedwait)

  parent reply	other threads:[~2018-10-11 20:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11 19:57 Ferruh Yigit
2018-10-11 19:57 ` [dpdk-dev] [PATCH 2/2] examples: sleep while waiting worker threads to terminate Ferruh Yigit
2018-10-11 20:32 ` Stephen Hemminger [this message]
2018-10-15 22:21 ` [dpdk-dev] [PATCH v2 1/2] eal: add API that sleeps while waiting for threads Ferruh Yigit
2018-10-15 22:21   ` [dpdk-dev] [PATCH v2 2/2] examples: sleep while waiting worker threads to terminate Ferruh Yigit
2023-06-12  2:38     ` Stephen Hemminger
2018-10-16  8:42   ` [dpdk-dev] [PATCH v2 1/2] eal: add API that sleeps while waiting for threads Ananyev, Konstantin
2018-10-16  9:05   ` Ananyev, Konstantin

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=20181011133213.2c37a464@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).