mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
add POSIX locking to authkey.c
fix esound protocol cpu consumption when finishing a stream git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@242 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
949014e154
commit
35148d8c05
4 changed files with 92 additions and 52 deletions
17
polyp/util.c
17
polyp/util.c
|
|
@ -501,3 +501,20 @@ finish:
|
|||
pa_xfree(gids);
|
||||
return r;
|
||||
}
|
||||
|
||||
int pa_lock_file(int fd, int b) {
|
||||
|
||||
struct flock flock;
|
||||
|
||||
flock.l_type = b ? F_WRLCK : F_UNLCK;
|
||||
flock.l_whence = SEEK_SET;
|
||||
flock.l_start = 0;
|
||||
flock.l_len = 0;
|
||||
|
||||
if (fcntl(fd, F_SETLKW, &flock) < 0) {
|
||||
pa_log(__FILE__": %slock failed: %s\n", !b ? "un" : "", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue