From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id EB29E1B178 for ; Thu, 11 Oct 2018 22:32:21 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id w14-v6so4763106plp.6 for ; Thu, 11 Oct 2018 13:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cf+n+Kmd70ahmDni371w3oB89LtEnWEtsFmrXfr9zRw=; b=uULHkhWweYX8l3MT79sIt5zi7yq4CKTnEzhzmT+HSXBHF+w41+VQfBJehjlIbVIVt0 gjPNGS4xVpYv/Ox9m2hkydCa6BOVqAJ9b1sVDgokGAO/JubFRNiBR5B+v7wLPtRpx2V1 pBK8i6gkexi6Ii/a2HzpB+PLEkZopKLxIy1bykjm9jkgfOOIJjCgMKL4IS3L6WwqQFUL PmFn4pGRtQH1jAvor2SQipqM1uHN62TAr9wxSvKVDJl57Z9kpjxWJKMq0GAhvz1egSUm fem6O5bjQYtSx67vZFesWpSkHuu22m/g6SLKuTO0vRsToyBC1iXfXiU8GKmMCgHgMPVC qcZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cf+n+Kmd70ahmDni371w3oB89LtEnWEtsFmrXfr9zRw=; b=c3fKyTt73CK7k85BeE2Ibc5HBd6RZGlc+LhX8d42zEc5vyP/GV9NyuXjyaq4QNlCvt 6elLfCpZF1FpQtpCVuQvEXSHEJEzKrC90EXH25UudqsM3Hpx9UCiXFddNJwqOqoViKrX IDSGAy79tPdEhkJr80ag18rUXCzwUszPfK+gvG5pRSQnlBIpmNSjKIrq4zvEj9EIqRUn Ne3BfMWJ2jeYtKsfc3MYCRHtW9617psNBAQK9LNWgYwMxD7iFw+3vT6nY2WY05aXg3C5 uk8nE505A4hWacnfPyowT5pmbobTn7bVKThYhSL0A+JpFj35VkP7mCE1W7+TqPmRlbMq gpIg== X-Gm-Message-State: ABuFfojwxV+gjj0sr/8PUl9MJaNwkSUYcT2+TXgVne8j2adJkCsE3xKK ZPp/SqU2lE4nznPu6y+26v0QAf6V3hs= X-Google-Smtp-Source: ACcGV62caKyl0D6cDQjACohEfQ+5MbEI06KVtrQ9WnQPSx2c4TUG951cfTLHBvA8KMCEXpBw3Y0aVg== X-Received: by 2002:a17:902:5a45:: with SMTP id f5-v6mr3028450plm.26.1539289941012; Thu, 11 Oct 2018 13:32:21 -0700 (PDT) Received: from xeon-e3 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id z11-v6sm63612757pfd.99.2018.10.11.13.32.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Oct 2018 13:32:20 -0700 (PDT) Date: Thu, 11 Oct 2018 13:32:13 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: dev@dpdk.org Message-ID: <20181011133213.2c37a464@xeon-e3> In-Reply-To: <20181011195753.4778-1-ferruh.yigit@intel.com> References: <20181011195753.4778-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/2] eal: add API that sleeps while waiting for threads X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Oct 2018 20:32:22 -0000 On Thu, 11 Oct 2018 20:57:52 +0100 Ferruh Yigit 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)