Skip to content

Commit

Permalink
queue: Set noexcept for io_uring_peek_batch_cqe as it does not raise
Browse files Browse the repository at this point in the history
exception, just return `0` if there is no ready entries.
  • Loading branch information
YoSTEALTH committed Apr 21, 2024
1 parent 4630e42 commit e9c1ce0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/liburing/queue.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cpdef int io_uring_ring_dontfork(io_uring ring) nogil
cpdef int io_uring_queue_exit(io_uring ring) nogil
cpdef unsigned int io_uring_peek_batch_cqe(io_uring ring,
io_uring_cqe cqes,
unsigned int count) nogil
unsigned int count) noexcept nogil
cpdef int io_uring_wait_cqes(io_uring ring,
io_uring_cqe cqe_ptr,
unsigned int wait_nr,
Expand Down
9 changes: 8 additions & 1 deletion src/liburing/queue.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ cpdef int io_uring_queue_exit(io_uring ring) nogil:
cpdef unsigned int io_uring_peek_batch_cqe(io_uring ring,
io_uring_cqe cqes,
unsigned int count) nogil:
unsigned int count) noexcept nogil:
return __io_uring_peek_batch_cqe(&ring.ptr, &cqes.ptr, count)
cpdef int io_uring_wait_cqes(io_uring ring,
Expand Down Expand Up @@ -426,3 +426,10 @@ cpdef inline io_uring_sqe io_uring_get_sqe(io_uring ring):
cdef io_uring_sqe sqe = io_uring_sqe(0)
sqe.ptr = __io_uring_get_sqe(&ring.ptr)
return sqe
cpdef inline unsigned int io_uring_for_each_cqe(io_uring ring,
io_uring_cqe cqe,
unsigned int head=0) nogil:
__io_uring_for_each_cqe(&ring.ptr, &head, cqe.ptr)
return head

0 comments on commit e9c1ce0

Please sign in to comment.