Split dev_close() routine in two parts.

The first part disconnects clients, the other closes the device
and frees audio buffers. No behavior change.
This commit is contained in:
Alexandre Ratchov 2019-08-29 09:29:35 +02:00
parent 803cf23380
commit 58f116481d
1 changed files with 12 additions and 2 deletions

View File

@ -61,6 +61,7 @@ void dev_adjpar(struct dev *, int, int, int);
int dev_open_do(struct dev *);
int dev_open(struct dev *);
void dev_exitall(struct dev *);
void dev_close_do(struct dev *);
void dev_close(struct dev *);
int dev_ref(struct dev *);
void dev_unref(struct dev *);
@ -1141,7 +1142,7 @@ dev_exitall(struct dev *d)
* ensure buffers are drained
*/
void
dev_close(struct dev *d)
dev_close_do(struct dev *d)
{
#ifdef DEBUG
if (log_level >= 3) {
@ -1150,7 +1151,6 @@ dev_close(struct dev *d)
}
#endif
d->pstate = DEV_CFG;
dev_exitall(d);
dev_sio_close(d);
if (d->mode & MODE_PLAY) {
if (d->encbuf != NULL)
@ -1164,6 +1164,16 @@ dev_close(struct dev *d)
}
}
/*
* Close the device and exit all slots
*/
void
dev_close(struct dev *d)
{
dev_exitall(d);
dev_close_do(d);
}
int
dev_ref(struct dev *d)
{