All of lore.kernel.org
 help / color / mirror / Atom feed
From: agk@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: device-mapper/dmeventd dmeventd.c
Date: 15 Jan 2007 22:37:40 -0000	[thread overview]
Message-ID: <20070115223740.6200.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/dm
Module name:	device-mapper
Changes by:	agk@sourceware.org	2007-01-15 22:37:40

Modified files:
	dmeventd       : dmeventd.c 

Log message:
	reduce some if/else complexity

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/device-mapper/dmeventd/dmeventd.c.diff?cvsroot=dm&r1=1.33&r2=1.34

--- device-mapper/dmeventd/dmeventd.c	2007/01/15 22:05:50	1.33
+++ device-mapper/dmeventd/dmeventd.c	2007/01/15 22:37:40	1.34
@@ -1295,14 +1295,15 @@
 	_lock_mutex();
 	while ((l = list_first(&_thread_registry_unused))) {
 		thread = list_item(l, struct thread_status);
-		if (thread->processing) {
-			goto out;	/* cleanup on the next round */
-		}
+		if (thread->processing)
+			break;	/* cleanup on the next round */
 
 		if (thread->status == DM_THREAD_RUNNING) {
 			thread->status = DM_THREAD_SHUTDOWN;
-			goto out;
-		} else if (thread->status == DM_THREAD_SHUTDOWN) {
+			break;
+		} 
+
+		if (thread->status == DM_THREAD_SHUTDOWN) {
 			if (!thread->events) {
 				/* turn codes negative -- should we be returning this? */
 				ret = _terminate_thread(thread);
@@ -1315,22 +1316,26 @@
 					       strerror(-ret));
 					stack;
 				}
-				goto out;
-			} else {
-				list_del(l);
-				syslog(LOG_ERR,
-				       "thread can't be on unused list unless !thread->events");
-				thread->status = DM_THREAD_RUNNING;
-				LINK_THREAD(thread);
-			}
-		} else if (thread->status == DM_THREAD_DONE) {
+				break;
+			} 
+
+			list_del(l);
+			syslog(LOG_ERR,
+			       "thread can't be on unused list unless !thread->events");
+			thread->status = DM_THREAD_RUNNING;
+			LINK_THREAD(thread);
+
+			continue;
+		}
+
+		if (thread->status == DM_THREAD_DONE) {
 			list_del(l);
 			pthread_join(thread->thread, NULL);
 			_lib_put(thread->dso_data);
 			_free_thread_status(thread);
 		}
 	}
-      out:
+
 	_unlock_mutex();
 }
 

             reply	other threads:[~2007-01-15 22:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15 22:37 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-07-09 13:26 device-mapper/dmeventd dmeventd.c mornfall
2007-04-24 13:29 mornfall
2007-01-19 18:08 agk
2007-01-16 20:27 agk
2007-01-16 20:13 agk
2007-01-15 19:19 agk
2007-01-15 18:58 agk

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=20070115223740.6200.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=dm-cvs@sourceware.org \
    --cc=dm-devel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.