Changeset View
Standalone View
share/man/man3/pthread_mutexattr.3
Show All 20 Lines | |||||||||
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||||||||
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||||||||
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||||||||
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||||||||
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||||||||
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||
.\" | .\" | ||||||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||||||
.Dd August 17, 2018 | .Dd October 1, 2021 | ||||||||
.Dt PTHREAD_MUTEXATTR 3 | .Dt PTHREAD_MUTEXATTR 3 | ||||||||
.Os | .Os | ||||||||
.Sh NAME | .Sh NAME | ||||||||
.Nm pthread_mutexattr_init , | .Nm pthread_mutexattr_init , | ||||||||
.Nm pthread_mutexattr_destroy , | .Nm pthread_mutexattr_destroy , | ||||||||
.Nm pthread_mutexattr_setprioceiling , | .Nm pthread_mutexattr_setprioceiling , | ||||||||
.Nm pthread_mutexattr_getprioceiling , | .Nm pthread_mutexattr_getprioceiling , | ||||||||
.Nm pthread_mutexattr_setprotocol , | .Nm pthread_mutexattr_setprotocol , | ||||||||
.Nm pthread_mutexattr_getprotocol , | .Nm pthread_mutexattr_getprotocol , | ||||||||
.Nm pthread_mutexattr_setpshared , | |||||||||
.Nm pthread_mutexattr_getpshared , | |||||||||
.Nm pthread_mutexattr_setrobust , | .Nm pthread_mutexattr_setrobust , | ||||||||
.Nm pthread_mutexattr_getrobust , | .Nm pthread_mutexattr_getrobust , | ||||||||
.Nm pthread_mutexattr_settype , | .Nm pthread_mutexattr_settype , | ||||||||
.Nm pthread_mutexattr_gettype | .Nm pthread_mutexattr_gettype | ||||||||
.Nd mutex attribute operations | .Nd mutex attribute operations | ||||||||
.Sh LIBRARY | .Sh LIBRARY | ||||||||
.Lb libpthread | .Lb libpthread | ||||||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||||||
Show All 12 Lines | |||||||||
.Fc | .Fc | ||||||||
.Ft int | .Ft int | ||||||||
.Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol" | .Fn pthread_mutexattr_setprotocol "pthread_mutexattr_t *attr" "int protocol" | ||||||||
.Ft int | .Ft int | ||||||||
.Fo pthread_mutexattr_getprotocol | .Fo pthread_mutexattr_getprotocol | ||||||||
.Fa "const pthread_mutexattr_t *restrict attr" "int *restrict protocol" | .Fa "const pthread_mutexattr_t *restrict attr" "int *restrict protocol" | ||||||||
.Fc | .Fc | ||||||||
.Ft int | .Ft int | ||||||||
.Fo pthread_mutexattr_setpshared | |||||||||
.Fa "pthread_mutexattr_t *attr" "int shared" | |||||||||
.Fc | |||||||||
.Ft int | |||||||||
.Fo pthread_mutexattr_getpshared | |||||||||
.Fa "const pthread_mutexattr_t *attr" "int *shared" | |||||||||
.Fc | |||||||||
.Ft int | |||||||||
.Fn pthread_mutexattr_setrobust "pthread_mutexattr_t *attr" "int robust" | .Fn pthread_mutexattr_setrobust "pthread_mutexattr_t *attr" "int robust" | ||||||||
.Ft int | .Ft int | ||||||||
.Fn pthread_mutexattr_getrobust "pthread_mutexattr_t *attr" "int *robust" | .Fn pthread_mutexattr_getrobust "pthread_mutexattr_t *attr" "int *robust" | ||||||||
.Ft int | .Ft int | ||||||||
.Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type" | .Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type" | ||||||||
.Ft int | .Ft int | ||||||||
.Fo pthread_mutexattr_gettype | .Fo pthread_mutexattr_gettype | ||||||||
.Fa "const pthread_mutexattr_t *restrict attr" "int *restrict type" | .Fa "const pthread_mutexattr_t *restrict attr" "int *restrict type" | ||||||||
Show All 14 Lines | |||||||||
The | The | ||||||||
.Fn pthread_mutexattr_destroy | .Fn pthread_mutexattr_destroy | ||||||||
function destroys | function destroys | ||||||||
.Fa attr . | .Fa attr . | ||||||||
.Pp | .Pp | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_set* | .Fn pthread_mutexattr_set* | ||||||||
functions set the attribute that corresponds to each function name. | functions set the attribute that corresponds to each function name. | ||||||||
.Pp | .Pp | ||||||||
markjUnsubmitted Done Inline Actions
markj: | |||||||||
The | The | ||||||||
Done Inline Actions
markj: | |||||||||
.Fn pthread_mutexattr_get* | .Fn pthread_mutexattr_get* | ||||||||
functions copy the value of the attribute that corresponds to each function name | functions copy the value of the attribute that corresponds to each function name | ||||||||
to the location pointed to by the second function parameter. | to the location pointed to by the second function parameter. | ||||||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||||||
If successful, these functions return 0. | If successful, these functions return 0. | ||||||||
Otherwise, an error number is returned to indicate the error. | Otherwise, an error number is returned to indicate the error. | ||||||||
.Sh ERRORS | .Sh ERRORS | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_init | .Fn pthread_mutexattr_init | ||||||||
function will fail if: | function will fail if: | ||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||
.It Bq Er ENOMEM | .It Bq Er ENOMEM | ||||||||
Out of memory. | Out of memory. | ||||||||
.El | .El | ||||||||
.Pp | .Pp | ||||||||
The | The | ||||||||
Done Inline Actions
markj: | |||||||||
.Fn pthread_mutexattr_destroy | .Fn pthread_mutexattr_destroy | ||||||||
function will fail if: | function will fail if: | ||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||||||
Invalid value for | Invalid value for | ||||||||
Done Inline ActionsIs "priority ceiling" explained anywhere? It is mentioned above with pthread_mutexattr_setprioceiling() but not really explained. markj: Is "priority ceiling" explained anywhere? It is mentioned above with… | |||||||||
Done Inline ActionsBasically the sentence above is the definition of the ceiling. SUSv8 contains much more elaborate description, I am not sure that we want to copy/paste it there. Might be in the next iteration, some text could be composed. kib: Basically the sentence above is the definition of the ceiling. SUSv8 contains much more… | |||||||||
.Fa attr . | .Fa attr . | ||||||||
.El | .El | ||||||||
.Pp | .Pp | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_setprioceiling | .Fn pthread_mutexattr_setprioceiling | ||||||||
Done Inline ActionsI think it should be "the robustness attribute" or something like that. Otherwise it seems like "robust" is an adjective for "attribute" and it reads strangely. markj: I think it should be "the robustness attribute" or something like that. Otherwise it seems like… | |||||||||
function will fail if: | function will fail if: | ||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||||||
Invalid value for | Invalid value for | ||||||||
.Fa attr , | .Fa attr , | ||||||||
or invalid value for | or invalid value for | ||||||||
.Fa prioceiling . | .Fa prioceiling . | ||||||||
Done Inline Actions"owning the mutex" and "while holding the mutex lock" are saying the same thing. markj: "owning the mutex" and "while holding the mutex lock" are saying the same thing. | |||||||||
.El | .El | ||||||||
Done Inline ActionsIn what scenario can another thread unlock a mutex held by a terminated thread? markj: In what scenario can another thread unlock a mutex held by a terminated thread? | |||||||||
Done Inline ActionsThis is mostly literal text from SUSv8. For normal and default non-robust types, they state that unlocking locked but not owned mutex is UB. They also talk about an option of not storing id of the owning thread for such mutexes in rationale. It is as if they want to avoid preventing an implementation from disallowing that. And for robust mutexes, unlock from other thread is the way in which the abandoned mutex is handled. This is described by the PTHREAD_MUTEX_ROBUST item below. kib: This is mostly literal text from SUSv8. For normal and default non-robust types, they state… | |||||||||
.Pp | .Pp | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_getprioceiling | .Fn pthread_mutexattr_getprioceiling | ||||||||
function will fail if: | function will fail if: | ||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||||||
Invalid value for | Invalid value for | ||||||||
.Fa attr . | .Fa attr . | ||||||||
.El | .El | ||||||||
.Pp | .Pp | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_setprotocol | .Fn pthread_mutexattr_setprotocol | ||||||||
function will fail if: | function will fail if: | ||||||||
Done Inline Actions
or "unrecoverable" markj: or "unrecoverable" | |||||||||
Done Inline ActionsI believe I took the term from SUS. kib: I believe I took the term from SUS. | |||||||||
Done Inline ActionsSUS seems to say "unusable"? In any case, I forgot that "unrepairable" is also an option, there was a typo in the initial version is all. I have no preference, they all seem correct. markj: SUS seems to say "unusable"? In any case, I forgot that "unrepairable" is also an option, there… | |||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||||||
Invalid value for | Invalid value for | ||||||||
.Fa attr , | .Fa attr , | ||||||||
or invalid value for | or invalid value for | ||||||||
.Fa protocol . | .Fa protocol . | ||||||||
.El | .El | ||||||||
.Pp | .Pp | ||||||||
Done Inline Actions
markj: | |||||||||
The | The | ||||||||
Done Inline Actions"The type" or ".Va type" markj: "The type" or ".Va type" | |||||||||
.Fn pthread_mutexattr_getprotocol | .Fn pthread_mutexattr_getprotocol | ||||||||
function will fail if: | function will fail if: | ||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||||||
Invalid value for | Invalid value for | ||||||||
.Fa attr . | .Fa attr . | ||||||||
Done Inline Actions
I'd add commas after "recursive locking" and "current thread". Otherwise it sounds like "recursive" applies to both locking and unlocking. markj: I'd add commas after "recursive locking" and "current thread". Otherwise it sounds like… | |||||||||
.El | .El | ||||||||
Done Inline Actions
markj: | |||||||||
.Pp | .Pp | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_setpshared | |||||||||
Done Inline Actions
markj: | |||||||||
function will fail if: | |||||||||
.Bl -tag -width Er | |||||||||
Done Inline ActionsSame comment about commas. markj: Same comment about commas. | |||||||||
.It Bq Er EINVAL | |||||||||
Invalid value for | |||||||||
.Fa attr , | |||||||||
or invalid value for | |||||||||
.Fa shared . | |||||||||
Done Inline Actions
or "causes an error to be returned" as you wrote above. markj: or "causes an error to be returned" as you wrote above. | |||||||||
.El | |||||||||
.Pp | |||||||||
The | |||||||||
.Fn pthread_mutexattr_getpshared | |||||||||
function will fail if: | |||||||||
.Bl -tag -width Er | |||||||||
.It Bq Er EINVAL | |||||||||
Invalid value for | |||||||||
.Fa attr . | |||||||||
.El | |||||||||
.Pp | |||||||||
The | |||||||||
.Fn pthread_mutexattr_settype | .Fn pthread_mutexattr_settype | ||||||||
function will fail if: | function will fail if: | ||||||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||||||
.It Bq Er EINVAL | .It Bq Er EINVAL | ||||||||
Invalid value for | Invalid value for | ||||||||
.Fa attr , | .Fa attr , | ||||||||
or invalid value for | or invalid value for | ||||||||
.Fa type . | .Fa type . | ||||||||
Show All 37 Lines | |||||||||
functions conform to | functions conform to | ||||||||
.St -p1003.1-96 | .St -p1003.1-96 | ||||||||
.Pp | .Pp | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_setprioceiling , | .Fn pthread_mutexattr_setprioceiling , | ||||||||
.Fn pthread_mutexattr_getprioceiling , | .Fn pthread_mutexattr_getprioceiling , | ||||||||
.Fn pthread_mutexattr_setprotocol , | .Fn pthread_mutexattr_setprotocol , | ||||||||
.Fn pthread_mutexattr_getprotocol , | .Fn pthread_mutexattr_getprotocol , | ||||||||
.Fn pthread_mutexattr_setpshared , | |||||||||
.Fn pthread_mutexattr_getpshared , | |||||||||
.Fn pthread_mutexattr_settype , | .Fn pthread_mutexattr_settype , | ||||||||
and | and | ||||||||
.Fn pthread_mutexattr_gettype | .Fn pthread_mutexattr_gettype | ||||||||
functions conform to | functions conform to | ||||||||
.St -susv2 . | .St -susv2 . | ||||||||
The | The | ||||||||
.Fn pthread_mutexattr_setrobust | .Fn pthread_mutexattr_setrobust | ||||||||
and | and | ||||||||
.Fn pthread_mutexattr_getrobust | .Fn pthread_mutexattr_getrobust | ||||||||
functions conform to | functions conform to | ||||||||
.St -susv4 . | .St -susv4 . |