Skip to content

[Support] Add Interrupt Handling in Pipe#16234

Closed
sunggg wants to merge 3 commits intoapache:mainfrom
sunggg:bugfix/2023-Dec/add-pipe-intrpt-handling-tvm-main
Closed

[Support] Add Interrupt Handling in Pipe#16234
sunggg wants to merge 3 commits intoapache:mainfrom
sunggg:bugfix/2023-Dec/add-pipe-intrpt-handling-tvm-main

Conversation

@sunggg
Copy link
Copy Markdown
Contributor

@sunggg sunggg commented Dec 13, 2023

/*!
* \return last error of socket operation
*/
static int GetLastErrorCode() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be passed as a second template function parameter to RetryCallOnEINTR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need specialized function in socket and pipe

For socket it should be WSAGetLastError() in windows, for pipe it should be GetLastError()

Comment thread src/support/pipe.h
@@ -67,8 +69,8 @@ class Pipe : public dmlc::Stream {
ICHECK(ReadFile(handle_, static_cast<TCHAR*>(ptr), size, &nread, nullptr))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on windows, create a lambda function that follows the same convention

auto fread = [&]() {
    if (!ReadFile(handle_, static_cast<TCHAR*>(ptr), size, &nread, nullptr)) return -1;
    if (nread != nwrite) return -1;
    return nread; 
};

* \file err_handling.h
* \brief Common error handling functions for socket.h and pipe.h
*/
#ifndef TVM_SUPPORT_ERR_HANDLING_H_
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errno_handling (specific to handle error number)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants