mirror of https://github.com/ericonr/sndio.git
On OSS/FreeBSD, set poll(2) threshold to 1 byte, so that it returs
POLLIN/POLLOUT whenever read/write can be called without blocking. By default OSS use 1 block of threshold.
This commit is contained in:
parent
2b58ec0677
commit
c5daeee294
|
@ -232,7 +232,7 @@ sio_oss_getfd(const char *str, unsigned int mode, int nbio)
|
|||
const char *p;
|
||||
char path[DEVPATH_MAX];
|
||||
unsigned int devnum;
|
||||
int fd, flags;
|
||||
int fd, flags, val;
|
||||
|
||||
p = _sndio_parsetype(str, "rsnd");
|
||||
if (p == NULL) {
|
||||
|
@ -263,6 +263,12 @@ sio_oss_getfd(const char *str, unsigned int mode, int nbio)
|
|||
DPERROR(path);
|
||||
return -1;
|
||||
}
|
||||
val = 1;
|
||||
if (ioctl(fd, SNDCTL_DSP_LOW_WATER, &val) < 0) {
|
||||
DPERROR("sio_oss_start: LOW_WATER");
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue