Add function UMTX_OP_WAIT_UINT, the function causes thread to wait for
an integer to be changed.
This commit is contained in:
parent
8611774e5e
commit
110de0cf17
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173800
@ -2385,6 +2385,26 @@ __umtx_op_wait(struct thread *td, struct _umtx_op_args *uap)
|
|||||||
return do_wait(td, uap->obj, uap->val, ts, 0);
|
return do_wait(td, uap->obj, uap->val, ts, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
__umtx_op_wait_uint(struct thread *td, struct _umtx_op_args *uap)
|
||||||
|
{
|
||||||
|
struct timespec *ts, timeout;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if (uap->uaddr2 == NULL)
|
||||||
|
ts = NULL;
|
||||||
|
else {
|
||||||
|
error = copyin(uap->uaddr2, &timeout, sizeof(timeout));
|
||||||
|
if (error != 0)
|
||||||
|
return (error);
|
||||||
|
if (timeout.tv_nsec >= 1000000000 ||
|
||||||
|
timeout.tv_nsec < 0)
|
||||||
|
return (EINVAL);
|
||||||
|
ts = &timeout;
|
||||||
|
}
|
||||||
|
return do_wait(td, uap->obj, uap->val, ts, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
__umtx_op_wake(struct thread *td, struct _umtx_op_args *uap)
|
__umtx_op_wake(struct thread *td, struct _umtx_op_args *uap)
|
||||||
{
|
{
|
||||||
@ -2480,7 +2500,8 @@ static _umtx_op_func op_table[] = {
|
|||||||
__umtx_op_set_ceiling, /* UMTX_OP_SET_CEILING */
|
__umtx_op_set_ceiling, /* UMTX_OP_SET_CEILING */
|
||||||
__umtx_op_cv_wait, /* UMTX_OP_CV_WAIT*/
|
__umtx_op_cv_wait, /* UMTX_OP_CV_WAIT*/
|
||||||
__umtx_op_cv_signal, /* UMTX_OP_CV_SIGNAL */
|
__umtx_op_cv_signal, /* UMTX_OP_CV_SIGNAL */
|
||||||
__umtx_op_cv_broadcast /* UMTX_OP_CV_BROADCAST */
|
__umtx_op_cv_broadcast, /* UMTX_OP_CV_BROADCAST */
|
||||||
|
__umtx_op_wait_uint /* UMTX_OP_WAIT_UINT */
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -2626,7 +2647,8 @@ static _umtx_op_func op_table_compat32[] = {
|
|||||||
__umtx_op_set_ceiling, /* UMTX_OP_SET_CEILING */
|
__umtx_op_set_ceiling, /* UMTX_OP_SET_CEILING */
|
||||||
__umtx_op_cv_wait_compat32, /* UMTX_OP_CV_WAIT*/
|
__umtx_op_cv_wait_compat32, /* UMTX_OP_CV_WAIT*/
|
||||||
__umtx_op_cv_signal, /* UMTX_OP_CV_SIGNAL */
|
__umtx_op_cv_signal, /* UMTX_OP_CV_SIGNAL */
|
||||||
__umtx_op_cv_broadcast /* UMTX_OP_CV_BROADCAST */
|
__umtx_op_cv_broadcast, /* UMTX_OP_CV_BROADCAST */
|
||||||
|
__umtx_op_wait_compat32 /* UMTX_OP_WAIT_UINT */
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -78,7 +78,8 @@ struct ucond {
|
|||||||
#define UMTX_OP_CV_WAIT 8
|
#define UMTX_OP_CV_WAIT 8
|
||||||
#define UMTX_OP_CV_SIGNAL 9
|
#define UMTX_OP_CV_SIGNAL 9
|
||||||
#define UMTX_OP_CV_BROADCAST 10
|
#define UMTX_OP_CV_BROADCAST 10
|
||||||
#define UMTX_OP_MAX 11
|
#define UMTX_OP_WAIT_UINT 11
|
||||||
|
#define UMTX_OP_MAX 12
|
||||||
|
|
||||||
/* flags for UMTX_OP_CV_WAIT */
|
/* flags for UMTX_OP_CV_WAIT */
|
||||||
#define UMTX_CHECK_UNPARKING 0x01
|
#define UMTX_CHECK_UNPARKING 0x01
|
||||||
|
Loading…
Reference in New Issue
Block a user