summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-03-19 14:31:43 +0100
committerKarolin Seeger <kseeger@samba.org>2009-09-09 12:45:00 +0200
commit996597e7a4468ff9e79efd29a320b6f5c98d5faa (patch)
tree68ae532512e0670d207f47fadcfd2b0d776d6ebe /lib/tevent
parent418fb51e85ffc36a01daa04fe0d1263cbf6a1872 (diff)
downloadsamba-996597e7a4468ff9e79efd29a320b6f5c98d5faa.tar.gz
tevent: fix the nesting logic
Only tevent_loop_once and tevent_loop_until() should care about the nesting level. This fixes the samba3 printing code where we use tevent_loop_wait() and don't allow nested events. We still call the nesting hook for all levels, we need to decide if we really want this... metze (cherry picked from commit 36e7045340bbc7d6567008bdd87c4cdf717835bd) (cherry picked from commit 01a4ec433627fe36c9eef7a8f1a7f45b86eb8262)
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/tevent.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index 43f174de045..3ce6e3e4777 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -468,6 +468,8 @@ int _tevent_loop_once(struct tevent_context *ev, const char *location)
errno = ELOOP;
return -1;
}
+ }
+ if (ev->nesting.level > 0) {
if (ev->nesting.hook_fn) {
int ret2;
ret2 = ev->nesting.hook_fn(ev,
@@ -485,7 +487,7 @@ int _tevent_loop_once(struct tevent_context *ev, const char *location)
ret = ev->ops->loop_once(ev, location);
- if (ev->nesting.level > 1) {
+ if (ev->nesting.level > 0) {
if (ev->nesting.hook_fn) {
int ret2;
ret2 = ev->nesting.hook_fn(ev,
@@ -525,6 +527,8 @@ int _tevent_loop_until(struct tevent_context *ev,
errno = ELOOP;
return -1;
}
+ }
+ if (ev->nesting.level > 0) {
if (ev->nesting.hook_fn) {
int ret2;
ret2 = ev->nesting.hook_fn(ev,
@@ -547,7 +551,7 @@ int _tevent_loop_until(struct tevent_context *ev,
}
}
- if (ev->nesting.level > 1) {
+ if (ev->nesting.level > 0) {
if (ev->nesting.hook_fn) {
int ret2;
ret2 = ev->nesting.hook_fn(ev,
@@ -601,9 +605,5 @@ int tevent_common_loop_wait(struct tevent_context *ev,
*/
int _tevent_loop_wait(struct tevent_context *ev, const char *location)
{
- int ret;
- ev->nesting.level++;
- ret = ev->ops->loop_wait(ev, location);
- ev->nesting.level--;
- return ret;
+ return ev->ops->loop_wait(ev, location);
}