aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/effects/null.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-05-12 18:26:33 -0700
committerChris Robinson <[email protected]>2016-05-12 18:41:33 -0700
commitef0d4f8210fe6aa65b9df96f3b64bf6f355e845a (patch)
tree401b74c7c7291229397883c73d4ad2c382275b7e /Alc/effects/null.c
parent186b54aa3d5f1398a384fa318aa000210d82437e (diff)
Provide (mostly) lockless updates for effect slots
Similar to the listener, separate containers are provided atomically for the mixer thread to apply updates without needing to block, and a free-list is used to reuse container objects. A couple things to note. First, the lock is still used when the effect state's deviceUpdate method is called to prevent asynchronous calls to reset the device from interfering. This can be fixed by using the list lock in ALc.c instead. Secondly, old effect states aren't immediately deleted when the effect type changes (the actual type, not just its properties). This is because the mixer thread is intended to be real-time safe, and so can't be freeing anything. They are cleared away when updates reuse the container they were kept in, and they don't incur any extra processing cost, but there may be cases where the memory is kept around until the effect slot is deleted.
Diffstat (limited to 'Alc/effects/null.c')
-rw-r--r--Alc/effects/null.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Alc/effects/null.c b/Alc/effects/null.c
index 0600703d..b90f75c9 100644
--- a/Alc/effects/null.c
+++ b/Alc/effects/null.c
@@ -15,10 +15,12 @@ typedef struct ALnullState {
/* This destructs (not free!) the effect state. It's called only when the
- * effect slot is no longer used.
+ * effect slot is no longer used. Make sure to call the parent Destruct
+ * function before returning!
*/
-static ALvoid ALnullState_Destruct(ALnullState* UNUSED(state))
+static ALvoid ALnullState_Destruct(ALnullState *state)
{
+ ALeffectState_Destruct(STATIC_CAST(ALeffectState,state));
}
/* This updates the device-dependant effect state. This is called on