Skip to content

Commit cffb7d6

Browse files
author
dave
committed
#25 Locking example improved
1 parent cdf573d commit cffb7d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/reentrantLocking/reentrantLocking.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void nestedFunction() {
2626
// here we take a nested lock, which is allowed by our lock, which is essentially reference counted for up to
2727
// 255 levels of depth.
2828
TaskMgrLock locker(myLock);
29-
log("in nested function", myVar);
29+
log("in nested function, lock count", myLock.getLockCount());
3030
}
3131

3232
void stateMachineLockingAsync();
@@ -46,6 +46,8 @@ void setup() {
4646

4747
log("locked synchronously, count", myLock.getLockCount());
4848

49+
nestedFunction();
50+
4951
// do something that's unlikely to be optimised out, to waste some time
5052
for(int i=0; i < 100; i++) {
5153
myVar++;

0 commit comments

Comments
 (0)