Date: Tue, 2 Jul 2002 16:54:43 -0700 (PDT) From: Julian Elischer <julian@elischer.org> To: Terry Lambert <tlambert2@mindspring.com> Cc: Garrett Wollman <wollman@lcs.mit.edu>, Jonathan Lemon <jlemon@flugsvamp.com>, current@FreeBSD.ORG Subject: Re: additional queue macro Message-ID: <Pine.BSF.4.21.0207021648200.97650-100000@InterJet.elischer.org> In-Reply-To: <Pine.BSF.4.21.0207021556300.97650-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2 Jul 2002, Julian Elischer wrote: Having just re-read my own mail I think I agree with jonathan now.. I think we neeed to either: 1/ augment the man page giving an example of how to do multiple removes from a list/queue. 2/ Explain in detail why using XXXX_FOREACH() is bad for this, and showing the alternative. 3/ Add something to the API that makes this easy to do. designing the API addition is tricky. Jonathan's effort was quite good, though I wonder if there is any way we can get it done without needing the decalration of 'tmp' separatly. (I can't think of a way). > /* > * Move any threads that should be suspended from the run queue > * to the suspend queue. > */ > TAILQ_FOREACH(from run queue) { > if (something) { > TAILQ_REMOVE(element from run queue) > TAILQ_INSERT_TAIL(onto suspend queue) > } > } > > Now, at first glance, the documentation suggests this should work, even > though we know it won't. but it doesn't crash.. it just terminates on the > first transfer because it reaches the end of the queue.. the suspend queue > that is.. TAILQ_FOREACH_REMOVABLE or TAILQ_FOREACH_SAFE (I prefer the first) are my suggestions for the name.) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0207021648200.97650-100000>