In this PR I also added a macro to simplify lock syntax:
acquire_lock!(lock_var, acquired => { you can use acquired here } );
It was usefull because sometime we have to acquire a lock only in the needed scopes. In this way it is more cleaner to use a mutex more times in the same flow.
For example assume you have two function fn_1(), fn_2()
fn_1() {
// it needs a lock
let acquired_var = self.lock_var.lock().unwrap();
acquired_var.do_something();
fn_2();
}
fn_2() {
// it needs a lock
let acquired_var = self.lock_var.lock().unwrap();
acquired_var.do_other_stuff();
}
if you call fn_1() a deadlock occurs.
with this macro you can do this without problems:
fn_1() {
// it needs a lock
acquire_lock!(self.lock_var, var => { var.do_something(); });
fn_2();
}
With just test_mode_4 path/rom.gba you can check the correct behavior with the help of PaletteVisualizer.
Documented here: BG_MODE_4
In this PR I also added a macro to simplify lock syntax:
acquire_lock!(lock_var, acquired => { you can use acquired here } );
It was usefull because sometime we have to acquire a lock only in the needed scopes. In this way it is more cleaner to use a mutex more times in the same flow.
For example assume you have two function
fn_1()
,fn_2()
if you call
fn_1()
a deadlock occurs.with this macro you can do this without problems:
With
just test_mode_4 path/rom.gba
you can check the correct behavior with the help ofPaletteVisualizer
.