fix variable names in the LUMIERA_RECCONDITION_SECTION_CHAIN macro (seems like a copy+paste error from recmutex.h)
This commit is contained in:
parent
f2406c23a1
commit
12a2eed583
3 changed files with 48 additions and 3 deletions
|
|
@ -65,13 +65,13 @@
|
|||
|
||||
|
||||
#define LUMIERA_RECCONDITION_SECTION_CHAIN(nobugflag, cnd) \
|
||||
for (lumiera_sectionlock *lumiera_lock_section_old_ = &lumiera_lock_section_, \
|
||||
for (lumiera_sectionlock *lumiera_reccond_section_old_ = &lumiera_reccond_section_, \
|
||||
NOBUG_CLEANUP(lumiera_sectionlock_ensureunlocked) lumiera_reccond_section_ = { \
|
||||
(void*)1, lumiera_reccondition_unlock_cb NOBUG_ALPHA_COMMA_NULL NOBUG_ALPHA_COMMA_NULL}; \
|
||||
lumiera_reccond_section_.lock;) \
|
||||
for ( \
|
||||
({ \
|
||||
REQUIRE (lumiera_lock_section_old_->lock, "section prematurely unlocked"); \
|
||||
REQUIRE (lumiera_reccond_section_old_->lock, "section prematurely unlocked"); \
|
||||
lumiera_reccond_section_.lock = (cnd); \
|
||||
NOBUG_IF_ALPHA(lumiera_reccond_section_.flag = &NOBUG_FLAG(nobugflag);) \
|
||||
RESOURCE_WAIT (nobugflag, (cnd)->rh, "acquire reccondmutex", lumiera_reccond_section_.rh) \
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
if (pthread_mutex_lock (&(cnd)->reccndmutex)) \
|
||||
LUMIERA_DIE (LOCK_ACQUIRE); \
|
||||
RESOURCE_STATE (nobugflag, NOBUG_RESOURCE_RECURSIVE, lumiera_reccond_section_.rh); \
|
||||
LUMIERA_SECTION_UNLOCK_(lumiera_lock_section_old_); \
|
||||
LUMIERA_SECTION_UNLOCK_(lumiera_reccond_section_old_); \
|
||||
} \
|
||||
}); \
|
||||
lumiera_reccond_section_.lock; \
|
||||
|
|
|
|||
|
|
@ -86,3 +86,12 @@ PLANNED "reccondition broadcasting" <<END
|
|||
END
|
||||
|
||||
|
||||
TEST "chained reccondition section" chainedrecconditionsection <<END
|
||||
out: outer reccondition locked section
|
||||
out: inner reccondition locked section
|
||||
END
|
||||
|
||||
TEST "nested reccondition section" nestedrecconditionsection <<END
|
||||
out: outer reccondition locked section
|
||||
out: inner reccondition locked section
|
||||
END
|
||||
|
|
|
|||
|
|
@ -318,5 +318,41 @@ TEST ("recconditionforgotunlock")
|
|||
lumiera_reccondition_destroy (&reccond, &NOBUG_FLAG(NOBUG_ON));
|
||||
}
|
||||
|
||||
TEST ("chainedrecconditionsection")
|
||||
{
|
||||
lumiera_reccondition outer, inner;
|
||||
lumiera_reccondition_init (&outer, "outer_recconditionsection", &NOBUG_FLAG(NOBUG_ON));
|
||||
lumiera_reccondition_init (&inner, "inner_recconditionsection", &NOBUG_FLAG(NOBUG_ON));
|
||||
|
||||
LUMIERA_RECCONDITION_SECTION (NOBUG_ON, &outer)
|
||||
{
|
||||
printf ("outer reccondition locked section\n");
|
||||
LUMIERA_RECCONDITION_SECTION_CHAIN (NOBUG_ON, &inner)
|
||||
{
|
||||
printf ("inner reccondition locked section\n");
|
||||
}
|
||||
}
|
||||
lumiera_reccondition_destroy (&outer, &NOBUG_FLAG(NOBUG_ON));
|
||||
lumiera_reccondition_destroy (&inner, &NOBUG_FLAG(NOBUG_ON));
|
||||
}
|
||||
|
||||
TEST ("nestedrecconditionsection")
|
||||
{
|
||||
lumiera_reccondition outer, inner;
|
||||
lumiera_reccondition_init (&outer, "outer_recconditionsection", &NOBUG_FLAG(NOBUG_ON));
|
||||
lumiera_reccondition_init (&inner, "inner_recconditionsection", &NOBUG_FLAG(NOBUG_ON));
|
||||
|
||||
LUMIERA_RECCONDITION_SECTION (NOBUG_ON, &outer)
|
||||
{
|
||||
printf ("outer reccondition locked section\n");
|
||||
LUMIERA_RECCONDITION_SECTION (NOBUG_ON, &inner)
|
||||
{
|
||||
printf ("inner reccondition locked section\n");
|
||||
}
|
||||
}
|
||||
lumiera_reccondition_destroy (&outer, &NOBUG_FLAG(NOBUG_ON));
|
||||
lumiera_reccondition_destroy (&inner, &NOBUG_FLAG(NOBUG_ON));
|
||||
}
|
||||
|
||||
|
||||
TESTS_END
|
||||
|
|
|
|||
Loading…
Reference in a new issue