diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alThunk.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/OpenAL32/alThunk.c b/OpenAL32/alThunk.c index ed0aa83c..0cebad42 100644 --- a/OpenAL32/alThunk.c +++ b/OpenAL32/alThunk.c @@ -62,6 +62,19 @@ ALenum NewThunkEntry(ALuint *index) ReadUnlock(&ThunkLock); WriteLock(&ThunkLock); + /* Double-check that there's still no free entries, in case another + * invocation just came through and increased the size of the array. + */ + for(;i < ThunkArraySize;i++) + { + if(ATOMIC_EXCHANGE(ALenum, &ThunkArray[i], AL_TRUE) == AL_FALSE) + { + WriteUnlock(&ThunkLock); + *index = i+1; + return AL_NO_ERROR; + } + } + NewList = al_calloc(16, ThunkArraySize*2 * sizeof(*ThunkArray)); if(!NewList) { |