Skip to content

Conversation

@sunggg
Copy link
Contributor

@sunggg sunggg commented Dec 13, 2023

/*!
* \return last error of socket operation
*/
static int GetLastErrorCode() {
Copy link
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
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()

@@ -67,8 +69,8 @@ class Pipe : public dmlc::Stream {
ICHECK(ReadFile(handle_, static_cast<TCHAR*>(ptr), size, &nread, nullptr))
Copy link
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
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