Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open() blocking forever #14

Open
diamondburned opened this issue Jun 10, 2019 · 2 comments
Open

Open() blocking forever #14

diamondburned opened this issue Jun 10, 2019 · 2 comments

Comments

@diamondburned
Copy link

The issue

In https://github.com/yobert/alsa/blob/master/device.go#L107, the os.OpenFile call does not have a syscall.O_NONBLOCK flag. I suspect this is causing the beep example on my pure ALSA setup to block. (I've tested and nailed it down to the Open() method). This does not happen with PulseAudio.

Proposal:

Add syscall.O_NONBLOCK like so:

device.fh, err = os.OpenFile(device.Path, os.O_RDWR | syscall.O_NONBLOCK, 0755)
@yobert
Copy link
Owner

yobert commented Aug 27, 2020

Ah! Yeah! Good idea. Though we might need to expose the behavior as an argument to the function, because from what I'm reading this might have a lot to do with which driver your sound card uses. Some of them only support one thing using it at a time, which means the blocking behavior might be more correct (at least in the POSIX-ey sense.)

@yobert
Copy link
Owner

yobert commented Sep 1, 2020

It does seem pedantic though to block until the sound becomes free. I wouldn't really want some queued up HONK to happen after stopping my music player.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants