diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:39:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:39:13 +0000 |
commit | 86fbb58c3ac0865482819c10a3e81f2eea001c36 (patch) | |
tree | 28c9e526ea739c6f9b89e36115e1e2698bddf981 /libmariadb/plugins | |
parent | Releasing progress-linux version 1:10.11.6-2~progress7.99u1. (diff) | |
download | mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.tar.xz mariadb-86fbb58c3ac0865482819c10a3e81f2eea001c36.zip |
Merging upstream version 1:10.11.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libmariadb/plugins')
-rw-r--r-- | libmariadb/plugins/pvio/pvio_npipe.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libmariadb/plugins/pvio/pvio_npipe.c b/libmariadb/plugins/pvio/pvio_npipe.c index 17c59cef..d2d5222a 100644 --- a/libmariadb/plugins/pvio/pvio_npipe.c +++ b/libmariadb/plugins/pvio/pvio_npipe.c @@ -150,19 +150,38 @@ static BOOL complete_io(HANDLE file, OVERLAPPED *ov, BOOL ret, DWORD timeout, DW return GetOverlappedResult(file, ov, size, FALSE); } +/* + Disable posting IO completion event to the port. + Handle can be bound to IOCP outside of the connector for other purposes + (e.g polling functionality) +*/ + +static inline void disable_iocp_notification(HANDLE *h) +{ + *h= (HANDLE) ((ULONG_PTR) *h | 1); +} + +static inline void enable_iocp_notification(HANDLE *h) +{ + *h= (HANDLE) ((ULONG_PTR) *h & ~1); +} + ssize_t pvio_npipe_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length) { BOOL ret; ssize_t r= -1; struct st_pvio_npipe *cpipe= NULL; DWORD size; + HANDLE *h; if (!pvio || !pvio->data) return -1; cpipe= (struct st_pvio_npipe *)pvio->data; - + h= &cpipe->overlapped.hEvent; + disable_iocp_notification(h); ret= ReadFile(cpipe->pipe, buffer, (DWORD)length, NULL, &cpipe->overlapped); + enable_iocp_notification(h); ret= complete_io(cpipe->pipe, &cpipe->overlapped, ret, pvio->timeout[PVIO_READ_TIMEOUT], &size); r= ret? (ssize_t) size:-1; @@ -175,13 +194,15 @@ ssize_t pvio_npipe_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length) struct st_pvio_npipe *cpipe= NULL; BOOL ret; DWORD size; - + HANDLE *h; if (!pvio || !pvio->data) return -1; cpipe= (struct st_pvio_npipe *)pvio->data; - + h= &cpipe->overlapped.hEvent; + disable_iocp_notification(h); ret= WriteFile(cpipe->pipe, buffer, (DWORD)length, NULL , &cpipe->overlapped); + enable_iocp_notification(h); ret= complete_io(cpipe->pipe, &cpipe->overlapped, ret, pvio->timeout[PVIO_WRITE_TIMEOUT], &size); r= ret ? (ssize_t)size : -1; return r; |