Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ovs-thread: Use fair (but nonrecursive) rwlocks on glibc.
glibc supports two kinds of rwlocks: - The default kind of rwlock always allows recursive read-locks to succeed, but threads blocked on acquiring the write-lock are treated unfairly, causing them to be delayed indefinitely as long as new readers continue to come along. - An alternative "writer nonrecursive" rwlock allows recursive read-locks to succeed only if there are no threads waiting for the write-lock. Otherwise, recursive read-lock attempts deadlock in the presence of blocking write-lock attempts. However, this kind of rwlock is fair to writer. POSIX allows the latter behavior, which essentially means that any portable pthread program cannot try to take read-locks recursively. Since that's true, we might as well use the latter kind of rwlock with glibc and get the benefit of fairness of writers. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Joe Stringer <joestringer@nicira.com>
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters