mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Aleksey Kuleshov <rndfax@yandex.ru>
To: barebox@lists.infradead.org
Cc: Aleksey Kuleshov <rndfax@yandex.ru>
Subject: [PATCH 1/2] poller: allow safely remove pollers in any time
Date: Thu,  3 Mar 2016 18:17:09 +0300	[thread overview]
Message-ID: <1457018230-4554-1-git-send-email-rndfax@yandex.ru> (raw)

---
 common/poller.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/common/poller.c b/common/poller.c
index 32795b6..7cec5d4 100644
--- a/common/poller.c
+++ b/common/poller.c
@@ -15,6 +15,7 @@
 
 static LIST_HEAD(poller_list);
 static int poller_active;
+static struct poller_struct *next;
 
 int poller_register(struct poller_struct *poller)
 {
@@ -33,6 +34,10 @@ int poller_unregister(struct poller_struct *poller)
 		return -ENODEV;
 
 
+	if (&next->list == &poller->list) {
+		next = list_entry(next->list.next, struct poller_struct, list);
+	}
+
 	list_del(&poller->list);
 	poller->registered = 0;
 
@@ -107,14 +112,14 @@ int poller_async_unregister(struct poller_async *pa)
 
 void poller_call(void)
 {
-	struct poller_struct *poller, *tmp;
+	struct poller_struct *poller;
 
 	if (poller_active)
 		return;
 
 	poller_active = 1;
 
-	list_for_each_entry_safe(poller, tmp, &poller_list, list)
+	list_for_each_entry_safe(poller, next, &poller_list, list)
 		poller->func(poller);
 
 	poller_active = 0;
-- 
2.6.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2016-03-03 15:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 15:17 Aleksey Kuleshov [this message]
2016-03-03 15:17 ` [PATCH 2/2] input: make the Input Core be the last in the poller queue Aleksey Kuleshov
2016-03-04  7:19   ` Sascha Hauer
2016-03-04 10:18     ` Aleksey Kuleshov
2016-03-07  7:30       ` Sascha Hauer
2016-03-07  9:16         ` Aleksey Kuleshov
2016-03-10  9:26           ` Sascha Hauer
2016-03-11 12:25             ` Aleksey Kuleshov
2016-03-11 14:51               ` Sascha Hauer
2016-03-11 15:12                 ` Aleksey Kuleshov
2016-03-14 16:26             ` Aleksey Kuleshov
2016-03-16  7:17               ` Sascha Hauer
2016-03-03 16:54 ` [PATCH 1/2] poller: allow safely remove pollers in any time Antony Pavlov

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=1457018230-4554-1-git-send-email-rndfax@yandex.ru \
    --to=rndfax@yandex.ru \
    --cc=barebox@lists.infradead.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