!1488 feat:add thread yeild

Merge pull request !1488 from maliang/master
This commit is contained in:
openharmony_ci 2024-08-28 09:40:23 +00:00 committed by Gitee
commit 2579bf3ffd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -112,7 +112,7 @@ int HdcTCPBase::WriteUvTcpFd(uv_tcp_t *tcp, uint8_t *buf, int size)
#else
int fd = reinterpret_cast<int>(uvfd);
#endif
constexpr int intrmax = 1000;
constexpr int intrmax = 60000;
int intrcnt = 0;
while (cnt > 0) {
#ifdef HDC_EMULATOR
@ -132,6 +132,7 @@ int HdcTCPBase::WriteUvTcpFd(uv_tcp_t *tcp, uint8_t *buf, int size)
WRITE_LOG(LOG_WARN, "WriteUvTcpFd fd:%d send interrupt err:%d", fd, err);
intrcnt = 0;
}
std::this_thread::yield();
continue;
} else {
WRITE_LOG(LOG_FATAL, "WriteUvTcpFd fd:%d send rc:%d err:%d", fd, rc, err);