version 2.33.0
piMinSleep() method
This commit is contained in:
@@ -686,7 +686,7 @@ int PIEthernet::readDevice(void * read_to, int max_size) {
|
||||
s = accept(sock, (sockaddr * )&client_addr, &slen);
|
||||
if (s == -1) {
|
||||
//piCoutObj << "Can`t accept new connection, " << ethErrorString();
|
||||
piMSleep(PIP_MIN_MSLEEP);
|
||||
piMinSleep();
|
||||
return -1;
|
||||
}
|
||||
rs = ethRecv(s, read_to, max_size);
|
||||
@@ -788,7 +788,7 @@ int PIEthernet::writeDevice(const void * data, int max_size) {
|
||||
//piCoutObj << "connect SingleTCP" << ip_s << ":" << port_s << "...";
|
||||
if (::connect(sock, (sockaddr * )&PRIVATE->addr_, sizeof(PRIVATE->addr_)) != 0) {
|
||||
//piCoutObj << "Can`t connect to " << ip_s << ":" << port_s << ", " << ethErrorString();
|
||||
piMSleep(PIP_MIN_MSLEEP);
|
||||
piMinSleep();
|
||||
return -1;
|
||||
}
|
||||
//piCoutObj << "ok, write SingleTCP" << int(data) << max_size << "bytes ...";
|
||||
|
||||
@@ -254,7 +254,7 @@ void PIIODevice::write_func() {
|
||||
int ret = write(item.first);
|
||||
threadedWriteEvent(item.second, ret);
|
||||
}
|
||||
piMSleep(PIP_MIN_MSLEEP);
|
||||
piMinSleep();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ PIByteArray PIIODevice::readForTime(double timeout_ms) {
|
||||
tm.reset();
|
||||
while (tm.elapsed_m() < timeout_ms) {
|
||||
ret = read(td, threaded_read_buffer_size);
|
||||
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else str.append(td, ret);
|
||||
}
|
||||
delete[] td;
|
||||
|
||||
@@ -434,7 +434,7 @@ bool PISerial::read(void * data, int size, double timeout_ms) {
|
||||
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
||||
ret = readDevice(&((uchar * )data)[all], size - all);
|
||||
if (ret > 0) all += ret;
|
||||
else piMSleep(PIP_MIN_MSLEEP);
|
||||
else piMinSleep();
|
||||
}
|
||||
setOption(BlockingRead, br);
|
||||
received(data, all);
|
||||
@@ -473,13 +473,13 @@ PIString PISerial::read(int size, double timeout_ms) {
|
||||
if (size <= 0) {
|
||||
while (tm_.elapsed_m() < timeout_ms) {
|
||||
ret = readDevice(td, 1024);
|
||||
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else str << PIString((char*)td, ret);
|
||||
}
|
||||
} else {
|
||||
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
||||
ret = readDevice(td, size - all);
|
||||
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else {
|
||||
str << PIString((char*)td, ret);
|
||||
all += ret;
|
||||
@@ -493,7 +493,7 @@ PIString PISerial::read(int size, double timeout_ms) {
|
||||
str << PIString((char*)td, all);
|
||||
while (all < size) {
|
||||
ret = readDevice(td, size - all);
|
||||
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else {
|
||||
str << PIString((char*)td, ret);
|
||||
all += ret;
|
||||
@@ -525,13 +525,13 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
|
||||
if (size <= 0) {
|
||||
while (tm_.elapsed_m() < timeout_ms) {
|
||||
ret = readDevice(td, 1024);
|
||||
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else str.append(td, ret);
|
||||
}
|
||||
} else {
|
||||
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
||||
ret = readDevice(td, size - all);
|
||||
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else {
|
||||
str.append(td, ret);
|
||||
all += ret;
|
||||
@@ -545,7 +545,7 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
|
||||
str.append(td, all);
|
||||
while (all < size) {
|
||||
ret = readDevice(td, size - all);
|
||||
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||
if (ret <= 0) piMinSleep();
|
||||
else {
|
||||
str.append(td, ret);
|
||||
all += ret;
|
||||
|
||||
Reference in New Issue
Block a user