Commit a3703887 authored by Hanspeter Portner's avatar Hanspeter Portner

cosmetics.

parent 1ef28af9
......@@ -9,4 +9,3 @@
* api: simplify forge:set
* api: improve Parameter
* state: store logFollow
* api: thread-safe update of moony->chunk
......@@ -627,21 +627,21 @@ _state_save(LV2_Handle instance,
lv2_atom_forge_set_sink(&moony->state_forge, _sink_non_rt, _deref, &ser);
// lock Lua state, so it cannot be accessed by realtime thread
_spin_lock(&moony->lock.state);
// restore Lua defined properties
lua_State *L = moony_current(moony);
lua_rawgeti(L, LUA_REGISTRYINDEX, UDATA_OFFSET + MOONY_UDATA_COUNT + MOONY_CCLOSURE_SAVE);
if(lua_pcall(L, 0, 0, 0))
_spin_lock(&moony->state_lock);
{
moony_err_async(moony, lua_tostring(L, -1));
lua_pop(L, 1);
}
// restore Lua defined properties
lua_State *L = moony_current(moony);
lua_rawgeti(L, LUA_REGISTRYINDEX, UDATA_OFFSET + MOONY_UDATA_COUNT + MOONY_CCLOSURE_SAVE);
if(lua_pcall(L, 0, 0, 0))
{
moony_err_async(moony, lua_tostring(L, -1));
lua_pop(L, 1);
}
#ifdef USE_MANUAL_GC
lua_gc(L, LUA_GCSTEP, 0);
lua_gc(L, LUA_GCSTEP, 0);
#endif
_unlock(&moony->lock.state);
}
_unlock(&moony->state_lock);
LV2_Atom *state_atom_new = (LV2_Atom *)ser.buf;
if( (state_atom_new->type) && (state_atom_new->size) )
......@@ -1051,6 +1051,7 @@ moony_init(moony_t *moony, const char *subject, double sample_rate,
atomic_init(&moony->vm_new, 0);
atomic_init(&moony->err_new, 0);
atomic_init(&moony->chunk_new, 0);
moony->state_lock = (atomic_flag)ATOMIC_FLAG_INIT;
moony->from_dsp = varchunk_new(MOONY_MAX_CHUNK_LEN * 2, true);
if(!moony->from_dsp)
......@@ -1260,8 +1261,6 @@ moony_init(moony_t *moony, const char *subject, double sample_rate,
moony->dirty_out = true; // trigger update of UI
moony->props_out = true; // trigger update of UI
atomic_flag_clear_explicit(&moony->lock.state, memory_order_relaxed);
moony_freeuserdata(moony);
moony->editor_hidden = ATOMIC_VAR_INIT(0);
......
......@@ -294,9 +294,7 @@ struct _moony_t {
int itr [MOONY_UDATA_COUNT];
int upc [MOONY_UPCLOSURE_COUNT];
struct {
atomic_flag state;
} lock;
atomic_flag state_lock;
LV2_Atom *state_atom;
atomic_uintptr_t state_atom_new;
......
......@@ -191,7 +191,7 @@ run(LV2_Handle instance, uint32_t nsamples)
moony_pre(&handle->moony, handle->notify);
if(_try_lock(&handle->moony.lock.state))
if(_try_lock(&handle->moony.state_lock))
{
// apply stash, if any
if(handle->stashed)
......@@ -238,7 +238,7 @@ run(LV2_Handle instance, uint32_t nsamples)
handle->stashed = false;
}
_unlock(&handle->moony.lock.state);
_unlock(&handle->moony.state_lock);
}
else
{
......
......@@ -195,7 +195,7 @@ run(LV2_Handle instance, uint32_t nsamples)
moony_pre(&handle->moony, handle->notify);
if(_try_lock(&handle->moony.lock.state))
if(_try_lock(&handle->moony.state_lock))
{
// apply stash, if any
if(handle->stashed)
......@@ -242,7 +242,7 @@ run(LV2_Handle instance, uint32_t nsamples)
handle->stashed = false;
}
_unlock(&handle->moony.lock.state);
_unlock(&handle->moony.state_lock);
}
else
{
......
......@@ -161,7 +161,7 @@ run(LV2_Handle instance, uint32_t nsamples)
moony_pre(&handle->moony, handle->notify);
if(_try_lock(&handle->moony.lock.state))
if(_try_lock(&handle->moony.state_lock))
{
// apply stash, if any
if(handle->stashed)
......@@ -207,7 +207,7 @@ run(LV2_Handle instance, uint32_t nsamples)
handle->stashed = false;
}
_unlock(&handle->moony.lock.state);
_unlock(&handle->moony.state_lock);
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment