io/uring/Ring: add method SetMaxWorkers()
This commit is contained in:

committed by
Max Kellermann

parent
c644b7616a
commit
7c9a460786
@ -30,6 +30,14 @@ public:
|
|||||||
return ring.GetFileDescriptor();
|
return ring.GetFileDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetMaxWorkers(unsigned values[2]) {
|
||||||
|
ring.SetMaxWorkers(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetMaxWorkers(unsigned bounded, unsigned unbounded) {
|
||||||
|
ring.SetMaxWorkers(bounded, unbounded);
|
||||||
|
}
|
||||||
|
|
||||||
struct io_uring_sqe *GetSubmitEntry() noexcept {
|
struct io_uring_sqe *GetSubmitEntry() noexcept {
|
||||||
return ring.GetSubmitEntry();
|
return ring.GetSubmitEntry();
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,14 @@ Ring::Ring(unsigned entries, struct io_uring_params ¶ms)
|
|||||||
throw MakeErrno(-error, "io_uring_queue_init_params() failed");
|
throw MakeErrno(-error, "io_uring_queue_init_params() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Ring::SetMaxWorkers(unsigned values[2])
|
||||||
|
{
|
||||||
|
if (int error = io_uring_register_iowq_max_workers(&ring, values);
|
||||||
|
error < 0)
|
||||||
|
throw MakeErrno(-error, "io_uring_register_iowq_max_workers() failed");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Ring::Submit()
|
Ring::Submit()
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,23 @@ public:
|
|||||||
return FileDescriptor(ring.ring_fd);
|
return FileDescriptor(ring.ring_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wrapper for io_uring_register_iowq_max_workers().
|
||||||
|
*
|
||||||
|
* Throws on error.
|
||||||
|
*/
|
||||||
|
void SetMaxWorkers(unsigned values[2]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This overload constructs an array for
|
||||||
|
* io_uring_register_iowq_max_workers() and discards the
|
||||||
|
* output values.
|
||||||
|
*/
|
||||||
|
void SetMaxWorkers(unsigned bounded, unsigned unbounded) {
|
||||||
|
unsigned values[2] = {bounded, unbounded};
|
||||||
|
SetMaxWorkers(values);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a submit queue entry or nullptr if the submit queue
|
* Returns a submit queue entry or nullptr if the submit queue
|
||||||
* is full.
|
* is full.
|
||||||
|
Reference in New Issue
Block a user