]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
this is a bad BIRDLOOP_INSIDE macro, don't like it mq-flocksim
authorMaria Matejka <mq@ucw.cz>
Sun, 23 Feb 2025 08:01:22 +0000 (09:01 +0100)
committerMaria Matejka <mq@ucw.cz>
Sun, 23 Feb 2025 18:07:35 +0000 (19:07 +0100)
lib/io-loop.h

index c043d1a0fcf4dc6fc585921bcd478e35d42796b2..d3b32e5d6e669ebfe3e65b65aa0b2044746f70e6 100644 (file)
@@ -61,6 +61,11 @@ void birdloop_leave(struct birdloop *loop);
 
 bool birdloop_inside(struct birdloop *loop);
 
+#define BIRDLOOP_INSIDE(_loop) for ( \
+    struct birdloop *_loop_inside = (birdloop_inside(_loop) ? (struct birdloop *) 1 : (birdloop_enter(_loop), _loop)); \
+    _loop_inside; \
+    _loop_inside = ((_loop_inside == _loop) ? (birdloop_leave(_loop_inside), NULL) : NULL))
+
 void birdloop_mask_wakeups(struct birdloop *loop);
 void birdloop_unmask_wakeups(struct birdloop *loop);