stopped at the same time that were using a class that had been marked for
deletion when its use count hits zero.
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@79792
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
{
struct moh_files_state *state = chan->music_state;
- ast_atomic_fetchadd_int(&state->class->inuse, -1);
-
if (chan && state) {
if (chan->stream) {
ast_closestream(chan->stream);
}
state->save_pos = state->pos;
}
- if (state->class->delete && !state->class->inuse)
+ if (state->class->delete && ast_atomic_dec_and_test(&state->class->inuse))
ast_moh_destroy_one(state->class);
}