diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 3ddc927977..4616619c86 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -3448,7 +3448,9 @@ fn (mut g Gen) lock_expr(node ast.LockExpr) { g.writeln('\t\tsync__RwMutex_lock((sync__RwMutex*)_arr_$mtxs[$mtxs]);') g.writeln('}') } + g.writeln('/*lock*/ {') g.stmts(node.stmts) + g.writeln('}') if node.lockeds.len == 0 { // this should not happen } else if node.lockeds.len == 1 { @@ -3465,7 +3467,7 @@ fn (mut g Gen) lock_expr(node ast.LockExpr) { g.writeln('\t\tsync__RwMutex_runlock((sync__RwMutex*)_arr_$mtxs[$mtxs]);') g.writeln('\telse') g.writeln('\t\tsync__RwMutex_unlock((sync__RwMutex*)_arr_$mtxs[$mtxs]);') - g.writeln('}') + g.write('}') } } diff --git a/vlib/v/tests/shared_arg_test.v b/vlib/v/tests/shared_arg_test.v index 43ffa513eb..e9a43fb817 100644 --- a/vlib/v/tests/shared_arg_test.v +++ b/vlib/v/tests/shared_arg_test.v @@ -48,12 +48,12 @@ fn test_shared_as_value() { assert v == 35 } rlock m { - w := m_val(m) - assert w == -3.125 + u := m_val(m) + assert u == -3.125 } lock a { - x := a_val(a) - assert x == 4 + u := a_val(a) + assert u == 4 } }