remove msleep, clean PIConditionVariable, rewrite pipipelinethread, etc...
This commit is contained in:
@@ -708,7 +708,7 @@ PIObject::Deleter::Deleter() {
|
|||||||
stopping = started = posted = false;
|
stopping = started = posted = false;
|
||||||
CONNECTL(&(PRIVATE->thread), started, [this](){proc();});
|
CONNECTL(&(PRIVATE->thread), started, [this](){proc();});
|
||||||
PRIVATE->thread.startOnce();
|
PRIVATE->thread.startOnce();
|
||||||
while (!started) piMSleep(1);
|
while (!started) piMSleep(PIP_MIN_MSLEEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -717,7 +717,7 @@ PIObject::Deleter::~Deleter() {
|
|||||||
stopping = true;
|
stopping = true;
|
||||||
PRIVATE->cond_var.notifyAll();
|
PRIVATE->cond_var.notifyAll();
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
while (PRIVATE->thread.isRunning()) piMSleep(1);
|
while (PRIVATE->thread.isRunning()) piMSleep(PIP_MIN_MSLEEP);
|
||||||
#endif
|
#endif
|
||||||
deleteAll();
|
deleteAll();
|
||||||
//piCout << "~Deleter ok";
|
//piCout << "~Deleter ok";
|
||||||
@@ -780,7 +780,7 @@ void PIObject::Deleter::deleteObject(PIObject * o) {
|
|||||||
//piCout << "[Deleter] delete" << (uintptr_t)o << "...";
|
//piCout << "[Deleter] delete" << (uintptr_t)o << "...";
|
||||||
if (o->isPIObject()) {
|
if (o->isPIObject()) {
|
||||||
//piCout << "[Deleter] delete" << (uintptr_t)o << "wait atomic ...";
|
//piCout << "[Deleter] delete" << (uintptr_t)o << "wait atomic ...";
|
||||||
while (o->isInEvent()) piMSleep(1);
|
while (o->isInEvent()) piMSleep(PIP_MIN_MSLEEP);
|
||||||
//piCout << "[Deleter] delete" << (uintptr_t)o << "wait atomic done";
|
//piCout << "[Deleter] delete" << (uintptr_t)o << "wait atomic done";
|
||||||
if (o->isPIObject()) delete o;
|
if (o->isPIObject()) delete o;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -469,13 +469,3 @@ PICout operator <<(PICout s, const PIDateTime & v) {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
|
||||||
void msleep(int msecs) {Sleep(msecs);}
|
|
||||||
#else
|
|
||||||
# ifdef FREERTOS
|
|
||||||
void msleep(int msecs) {vTaskDelay(msecs / portTICK_PERIOD_MS);}
|
|
||||||
# else
|
|
||||||
void msleep(int msecs) {usleep(msecs * 1000);}
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -29,8 +29,6 @@
|
|||||||
#ifdef QNX
|
#ifdef QNX
|
||||||
# include <time.h>
|
# include <time.h>
|
||||||
#endif
|
#endif
|
||||||
//! @brief Sleep for "msecs" milliseconds
|
|
||||||
PIP_EXPORT void msleep(int msecs);
|
|
||||||
|
|
||||||
/*! @brief Precise sleep for "usecs" microseconds
|
/*! @brief Precise sleep for "usecs" microseconds
|
||||||
* \details This function consider \c "usleep" offset
|
* \details This function consider \c "usleep" offset
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ int PIEthernet::readDevice(void * read_to, int max_size) {
|
|||||||
s = accept(sock, (sockaddr * )&client_addr, &slen);
|
s = accept(sock, (sockaddr * )&client_addr, &slen);
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
//piCoutObj << "Can`t accept new connection, " << ethErrorString();
|
//piCoutObj << "Can`t accept new connection, " << ethErrorString();
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
rs = ethRecv(s, read_to, max_size);
|
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 << "...";
|
//piCoutObj << "connect SingleTCP" << ip_s << ":" << port_s << "...";
|
||||||
if (::connect(sock, (sockaddr * )&PRIVATE->addr_, sizeof(PRIVATE->addr_)) != 0) {
|
if (::connect(sock, (sockaddr * )&PRIVATE->addr_, sizeof(PRIVATE->addr_)) != 0) {
|
||||||
//piCoutObj << "Can`t connect to " << ip_s << ":" << port_s << ", " << ethErrorString();
|
//piCoutObj << "Can`t connect to " << ip_s << ":" << port_s << ", " << ethErrorString();
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//piCoutObj << "ok, write SingleTCP" << int(data) << max_size << "bytes ...";
|
//piCoutObj << "ok, write SingleTCP" << int(data) << max_size << "bytes ...";
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ void PIIODevice::write_func() {
|
|||||||
int ret = write(item.first);
|
int ret = write(item.first);
|
||||||
threadedWriteEvent(item.second, ret);
|
threadedWriteEvent(item.second, ret);
|
||||||
}
|
}
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ PIByteArray PIIODevice::readForTime(double timeout_ms) {
|
|||||||
tm.reset();
|
tm.reset();
|
||||||
while (tm.elapsed_m() < timeout_ms) {
|
while (tm.elapsed_m() < timeout_ms) {
|
||||||
ret = read(td, threaded_read_buffer_size);
|
ret = read(td, threaded_read_buffer_size);
|
||||||
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
|
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||||
else str.append(td, ret);
|
else str.append(td, ret);
|
||||||
}
|
}
|
||||||
delete[] td;
|
delete[] td;
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ bool PISerial::read(void * data, int size, double timeout_ms) {
|
|||||||
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
||||||
ret = readDevice(&((uchar * )data)[all], size - all);
|
ret = readDevice(&((uchar * )data)[all], size - all);
|
||||||
if (ret > 0) all += ret;
|
if (ret > 0) all += ret;
|
||||||
else msleep(PIP_MIN_MSLEEP);
|
else piMSleep(PIP_MIN_MSLEEP);
|
||||||
}
|
}
|
||||||
setOption(BlockingRead, br);
|
setOption(BlockingRead, br);
|
||||||
received(data, all);
|
received(data, all);
|
||||||
@@ -473,13 +473,13 @@ PIString PISerial::read(int size, double timeout_ms) {
|
|||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
while (tm_.elapsed_m() < timeout_ms) {
|
while (tm_.elapsed_m() < timeout_ms) {
|
||||||
ret = readDevice(td, 1024);
|
ret = readDevice(td, 1024);
|
||||||
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
|
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||||
else str << PIString((char*)td, ret);
|
else str << PIString((char*)td, ret);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
||||||
ret = readDevice(td, size - all);
|
ret = readDevice(td, size - all);
|
||||||
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
|
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||||
else {
|
else {
|
||||||
str << PIString((char*)td, ret);
|
str << PIString((char*)td, ret);
|
||||||
all += ret;
|
all += ret;
|
||||||
@@ -493,7 +493,7 @@ PIString PISerial::read(int size, double timeout_ms) {
|
|||||||
str << PIString((char*)td, all);
|
str << PIString((char*)td, all);
|
||||||
while (all < size) {
|
while (all < size) {
|
||||||
ret = readDevice(td, size - all);
|
ret = readDevice(td, size - all);
|
||||||
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
|
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||||
else {
|
else {
|
||||||
str << PIString((char*)td, ret);
|
str << PIString((char*)td, ret);
|
||||||
all += ret;
|
all += ret;
|
||||||
@@ -525,13 +525,13 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
|
|||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
while (tm_.elapsed_m() < timeout_ms) {
|
while (tm_.elapsed_m() < timeout_ms) {
|
||||||
ret = readDevice(td, 1024);
|
ret = readDevice(td, 1024);
|
||||||
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
|
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||||
else str.append(td, ret);
|
else str.append(td, ret);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
while (all < size && tm_.elapsed_m() < timeout_ms) {
|
||||||
ret = readDevice(td, size - all);
|
ret = readDevice(td, size - all);
|
||||||
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
|
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||||
else {
|
else {
|
||||||
str.append(td, ret);
|
str.append(td, ret);
|
||||||
all += ret;
|
all += ret;
|
||||||
@@ -545,7 +545,7 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
|
|||||||
str.append(td, all);
|
str.append(td, all);
|
||||||
while (all < size) {
|
while (all < size) {
|
||||||
ret = readDevice(td, size - all);
|
ret = readDevice(td, size - all);
|
||||||
if (ret <= 0) msleep(PIP_MIN_MSLEEP);
|
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
|
||||||
else {
|
else {
|
||||||
str.append(td, ret);
|
str.append(td, ret);
|
||||||
all += ret;
|
all += ret;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void PIProcess::exec_() {
|
|||||||
startOnce();
|
startOnce();
|
||||||
//cout << "exec wait" << endl;
|
//cout << "exec wait" << endl;
|
||||||
while (!is_exec)
|
while (!is_exec)
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
//cout << "exec end" << endl;
|
//cout << "exec end" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,9 +145,9 @@ bool PISystemMonitor::startOnSelf(int interval_ms) {
|
|||||||
|
|
||||||
|
|
||||||
PIVector<PISystemMonitor::ThreadStats> PISystemMonitor::threadsStatistic() const {
|
PIVector<PISystemMonitor::ThreadStats> PISystemMonitor::threadsStatistic() const {
|
||||||
mutex_.lock();
|
lock();
|
||||||
PIVector<PISystemMonitor::ThreadStats> ret = cur_ts;
|
PIVector<PISystemMonitor::ThreadStats> ret = cur_ts;
|
||||||
mutex_.unlock();
|
unlock();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,9 +341,9 @@ void PISystemMonitor::run() {
|
|||||||
//piCout << ts_new.cpu_load_user;
|
//piCout << ts_new.cpu_load_user;
|
||||||
}
|
}
|
||||||
last_tm = cur_tm;
|
last_tm = cur_tm;
|
||||||
mutex_.lock();
|
lock();
|
||||||
cur_ts = cur_tm.values();
|
cur_ts = cur_tm.values();
|
||||||
mutex_.unlock();
|
unlock();
|
||||||
tstat.ram_total = totalRAM();
|
tstat.ram_total = totalRAM();
|
||||||
tstat.ram_used = usedRAM();
|
tstat.ram_used = usedRAM();
|
||||||
tstat.ram_free = freeRAM();
|
tstat.ram_free = freeRAM();
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ PRIVATE_DEFINITION_START(PIConditionVariable)
|
|||||||
#else
|
#else
|
||||||
pthread_cond_t nativeHandle;
|
pthread_cond_t nativeHandle;
|
||||||
#endif
|
#endif
|
||||||
bool isDestroying;
|
|
||||||
PRIVATE_DEFINITION_END(PIConditionVariable)
|
PRIVATE_DEFINITION_END(PIConditionVariable)
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +43,6 @@ PIConditionVariable::PIConditionVariable() {
|
|||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
InitializeConditionVariable(&PRIVATE->nativeHandle);
|
InitializeConditionVariable(&PRIVATE->nativeHandle);
|
||||||
#else
|
#else
|
||||||
PRIVATE->isDestroying = false;
|
|
||||||
|
|
||||||
pthread_condattr_t condattr;
|
pthread_condattr_t condattr;
|
||||||
pthread_condattr_init(&condattr);
|
pthread_condattr_init(&condattr);
|
||||||
@@ -84,7 +82,6 @@ void PIConditionVariable::wait(PIMutex& lk, const std::function<bool()>& conditi
|
|||||||
#else
|
#else
|
||||||
pthread_cond_wait(&PRIVATE->nativeHandle, (pthread_mutex_t*)lk.handle());
|
pthread_cond_wait(&PRIVATE->nativeHandle, (pthread_mutex_t*)lk.handle());
|
||||||
#endif
|
#endif
|
||||||
if (PRIVATE->isDestroying) return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +97,6 @@ bool PIConditionVariable::waitFor(PIMutex &lk, int timeoutMs) {
|
|||||||
st.toTimespec(&expire_ts);
|
st.toTimespec(&expire_ts);
|
||||||
isNotTimeout = pthread_cond_timedwait(&PRIVATE->nativeHandle, (pthread_mutex_t*)lk.handle(), &expire_ts) == 0;
|
isNotTimeout = pthread_cond_timedwait(&PRIVATE->nativeHandle, (pthread_mutex_t*)lk.handle(), &expire_ts) == 0;
|
||||||
#endif
|
#endif
|
||||||
if (PRIVATE->isDestroying) return false;
|
|
||||||
return isNotTimeout;
|
return isNotTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +123,6 @@ bool PIConditionVariable::waitFor(PIMutex& lk, int timeoutMs, const std::functio
|
|||||||
bool isTimeout = pthread_cond_timedwait(&PRIVATE->nativeHandle, (pthread_mutex_t*)lk.handle(), &expire_ts) != 0;
|
bool isTimeout = pthread_cond_timedwait(&PRIVATE->nativeHandle, (pthread_mutex_t*)lk.handle(), &expire_ts) != 0;
|
||||||
#endif
|
#endif
|
||||||
if (isTimeout) return false;
|
if (isTimeout) return false;
|
||||||
if (PRIVATE->isDestroying) return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "pithread.h"
|
#include "pithread.h"
|
||||||
#include "piqueue.h"
|
#include "piqueue.h"
|
||||||
|
#include "piconditionvar.h"
|
||||||
|
|
||||||
|
|
||||||
template <typename Tin, typename Tout>
|
template <typename Tin, typename Tout>
|
||||||
class PIPipelineThread : public PIThread
|
class PIPipelineThread : public PIThread
|
||||||
@@ -35,10 +37,10 @@ public:
|
|||||||
cnt = 0;
|
cnt = 0;
|
||||||
max_size = 0;
|
max_size = 0;
|
||||||
wait_next_pipe = false;
|
wait_next_pipe = false;
|
||||||
next_overload = false;
|
|
||||||
}
|
}
|
||||||
~PIPipelineThread() {
|
~PIPipelineThread() {
|
||||||
stop();
|
stop();
|
||||||
|
cv.notifyAll();
|
||||||
if (!waitForFinish(1000)) {
|
if (!waitForFinish(1000)) {
|
||||||
piCoutObj << "terminating self thread";
|
piCoutObj << "terminating self thread";
|
||||||
terminate();
|
terminate();
|
||||||
@@ -46,21 +48,27 @@ public:
|
|||||||
}
|
}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void connectTo(PIPipelineThread<Tout, T> * next) {
|
void connectTo(PIPipelineThread<Tout, T> * next) {
|
||||||
CONNECT2(void, Tout, bool *, this, calculated, next, enqueue)
|
CONNECT3(void, Tout, bool, bool *, this, calculated, next, enqueue)
|
||||||
}
|
}
|
||||||
EVENT2(calculated, const Tout &, v, bool *, overload)
|
EVENT3(calculated, const Tout &, v, bool, wait, bool *, overload)
|
||||||
void enqueue(const Tin &v) {enqueue(v, 0);}
|
EVENT_HANDLER3(void, enqueue, const Tin &, v, bool, wait, bool *, overload) {
|
||||||
EVENT_HANDLER2(void, enqueue, const Tin &, v, bool *, overload) {
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
//piCoutObj << "enque" << overload;
|
//piCoutObj << "enque" << overload;
|
||||||
|
if (wait && max_size != 0) {
|
||||||
|
mutex_wait.lock();
|
||||||
|
while (in.size() >= max_size) cv_wait.wait(mutex_wait);
|
||||||
|
mutex_wait.unlock();
|
||||||
|
}
|
||||||
if (max_size == 0 || in.size() < max_size) {
|
if (max_size == 0 || in.size() < max_size) {
|
||||||
in.enqueue(v);
|
in.enqueue(v);
|
||||||
|
cv.notifyAll();
|
||||||
if (overload) *overload = false;
|
if (overload) *overload = false;
|
||||||
} else {
|
} else {
|
||||||
if (overload) *overload = true;
|
if (overload) *overload = true;
|
||||||
}
|
}
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
void enqueue(const Tin &v, bool wait = false) {enqueue(v, wait, nullptr);}
|
||||||
const ullong * counterPtr() const {return &cnt;}
|
const ullong * counterPtr() const {return &cnt;}
|
||||||
ullong counter() const {return cnt;}
|
ullong counter() const {return cnt;}
|
||||||
bool isEmpty() {
|
bool isEmpty() {
|
||||||
@@ -79,15 +87,18 @@ public:
|
|||||||
}
|
}
|
||||||
void clear() {
|
void clear() {
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
|
mutex_wait.lock();
|
||||||
in.clear();
|
in.clear();
|
||||||
next_overload = false;
|
cv_wait.notifyAll();
|
||||||
|
mutex_wait.unlock();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
void stopCalc(int wait_delay = 100) {
|
void stopCalc(int wait_delay = 100) {
|
||||||
if (isRunning()) {
|
if (isRunning()) {
|
||||||
stop();
|
stop();
|
||||||
|
cv.notifyAll();
|
||||||
if (!waitForFinish(wait_delay)) {
|
if (!waitForFinish(wait_delay)) {
|
||||||
mutex_l.unlock();
|
mutex_last.unlock();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
terminate();
|
terminate();
|
||||||
}
|
}
|
||||||
@@ -95,18 +106,14 @@ public:
|
|||||||
}
|
}
|
||||||
Tout getLast() {
|
Tout getLast() {
|
||||||
Tout ret;
|
Tout ret;
|
||||||
mutex_l.lock();
|
mutex_last.lock();
|
||||||
ret = last;
|
ret = last;
|
||||||
mutex_l.unlock();
|
mutex_last.unlock();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint maxQueSize() {
|
uint maxQueSize() {
|
||||||
uint ret;
|
return max_size;
|
||||||
mutex.lock();
|
|
||||||
ret = max_size;
|
|
||||||
mutex.unlock();
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMaxQueSize(uint count) {
|
void setMaxQueSize(uint count) {
|
||||||
@@ -127,39 +134,35 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void begin() {cnt = 0;}
|
void begin() {cnt = 0;}
|
||||||
void run() {
|
void run() {
|
||||||
//piCoutObj << "run ...";
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
if (in.isEmpty()) {
|
while (in.isEmpty()) {
|
||||||
mutex.unlock();
|
cv.wait(mutex);
|
||||||
piMSleep(10);
|
if (terminating) {
|
||||||
//piCoutObj << "run in empty";
|
mutex.unlock();
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (next_overload && wait_next_pipe) {
|
|
||||||
mutex.unlock();
|
|
||||||
//piCoutObj << "wait" << &next_overload;
|
|
||||||
calculated(last, &next_overload);
|
|
||||||
piMSleep(10);
|
|
||||||
} else {
|
|
||||||
Tin t = in.dequeue();
|
|
||||||
mutex.unlock();
|
|
||||||
bool ok = true;
|
|
||||||
Tout r = calc(t, ok);
|
|
||||||
if (ok) {
|
|
||||||
mutex_l.lock();
|
|
||||||
last = r;
|
|
||||||
mutex_l.unlock();
|
|
||||||
cnt++;
|
|
||||||
//piCoutObj << "calc ok" << &next_overload;
|
|
||||||
calculated(r, &next_overload);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mutex_wait.lock();
|
||||||
|
Tin t = in.dequeue();
|
||||||
|
mutex.unlock();
|
||||||
|
cv_wait.notifyAll();
|
||||||
|
mutex_wait.unlock();
|
||||||
|
bool ok = true;
|
||||||
|
Tout r = calc(t, ok);
|
||||||
|
if (ok) {
|
||||||
|
mutex_last.lock();
|
||||||
|
last = r;
|
||||||
|
mutex_last.unlock();
|
||||||
|
cnt++;
|
||||||
|
//piCoutObj << "calc ok";
|
||||||
|
calculated(r, wait_next_pipe);
|
||||||
|
}
|
||||||
//piCoutObj << "run ok";
|
//piCoutObj << "run ok";
|
||||||
}
|
}
|
||||||
PIMutex mutex;
|
PIMutex mutex, mutex_wait;
|
||||||
PIMutex mutex_l;
|
PIConditionVariable cv, cv_wait;
|
||||||
|
PIMutex mutex_last;
|
||||||
bool wait_next_pipe;
|
bool wait_next_pipe;
|
||||||
bool next_overload;
|
|
||||||
ullong cnt;
|
ullong cnt;
|
||||||
PIQueue<Tin> in;
|
PIQueue<Tin> in;
|
||||||
Tout last;
|
Tout last;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ event started();
|
|||||||
while (isRunning()) {
|
while (isRunning()) {
|
||||||
run();
|
run();
|
||||||
ThreadFunc();
|
ThreadFunc();
|
||||||
msleep(timer_delay);
|
piMSleep(timer_delay);
|
||||||
}
|
}
|
||||||
event stopped();
|
event stopped();
|
||||||
end();
|
end();
|
||||||
@@ -402,7 +402,7 @@ bool PIThread::waitForFinish(int timeout_msecs) {
|
|||||||
if (!running_) return true;
|
if (!running_) return true;
|
||||||
if (timeout_msecs < 0) {
|
if (timeout_msecs < 0) {
|
||||||
while (running_) {
|
while (running_) {
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
if (!isExists(PRIVATE->thread)) {
|
if (!isExists(PRIVATE->thread)) {
|
||||||
unlock();
|
unlock();
|
||||||
@@ -414,7 +414,7 @@ bool PIThread::waitForFinish(int timeout_msecs) {
|
|||||||
}
|
}
|
||||||
tmf_.reset();
|
tmf_.reset();
|
||||||
while (running_ && tmf_.elapsed_m() < timeout_msecs) {
|
while (running_ && tmf_.elapsed_m() < timeout_msecs) {
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
if (!isExists(PRIVATE->thread)) {
|
if (!isExists(PRIVATE->thread)) {
|
||||||
unlock();
|
unlock();
|
||||||
@@ -430,12 +430,12 @@ bool PIThread::waitForStart(int timeout_msecs) {
|
|||||||
if (running_) return true;
|
if (running_) return true;
|
||||||
if (timeout_msecs < 0) {
|
if (timeout_msecs < 0) {
|
||||||
while (!running_)
|
while (!running_)
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
tms_.reset();
|
tms_.reset();
|
||||||
while (!running_ && tms_.elapsed_m() < timeout_msecs)
|
while (!running_ && tms_.elapsed_m() < timeout_msecs)
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
return tms_.elapsed_m() < timeout_msecs;
|
return tms_.elapsed_m() < timeout_msecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,9 +456,9 @@ void PIThread::_beginThread() {
|
|||||||
PIINTROSPECTION_THREAD_START(this);
|
PIINTROSPECTION_THREAD_START(this);
|
||||||
REGISTER_THREAD(this);
|
REGISTER_THREAD(this);
|
||||||
running_ = true;
|
running_ = true;
|
||||||
if (lockRun) mutex_.lock();
|
if (lockRun) thread_mutex.lock();
|
||||||
begin();
|
begin();
|
||||||
if (lockRun) mutex_.unlock();
|
if (lockRun) thread_mutex.unlock();
|
||||||
started();
|
started();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,7 +466,7 @@ void PIThread::_beginThread() {
|
|||||||
void PIThread::_runThread() {
|
void PIThread::_runThread() {
|
||||||
PIINTROSPECTION_THREAD_RUN(this);
|
PIINTROSPECTION_THREAD_RUN(this);
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "...";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "...";
|
||||||
if (lockRun) mutex_.lock();
|
if (lockRun) thread_mutex.lock();
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "ok";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "lock" << "ok";
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "run" << "...";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "run" << "...";
|
||||||
#ifdef PIP_INTROSPECTION
|
#ifdef PIP_INTROSPECTION
|
||||||
@@ -482,7 +482,7 @@ void PIThread::_runThread() {
|
|||||||
if (ret_func != 0) ret_func(data_);
|
if (ret_func != 0) ret_func(data_);
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "ret_func" << "ok";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "ret_func" << "ok";
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "unlock" << "...";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "unlock" << "...";
|
||||||
if (lockRun) mutex_.unlock();
|
if (lockRun) thread_mutex.unlock();
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "unlock" << "ok";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "unlock" << "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,11 +491,11 @@ void PIThread::_endThread() {
|
|||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "...";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "...";
|
||||||
stopped();
|
stopped();
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "ok";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "ok";
|
||||||
if (lockRun) mutex_.lock();
|
if (lockRun) thread_mutex.lock();
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "end" << "...";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "end" << "...";
|
||||||
end();
|
end();
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "ok";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "stop" << "ok";
|
||||||
if (lockRun) mutex_.unlock();
|
if (lockRun) thread_mutex.unlock();
|
||||||
terminating = running_ = false;
|
terminating = running_ = false;
|
||||||
tid_ = -1;
|
tid_ = -1;
|
||||||
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "exit";
|
//PICout(PICoutManipulators::DefaultControls) << "thread" << this << "exit";
|
||||||
|
|||||||
@@ -131,11 +131,15 @@ public:
|
|||||||
|
|
||||||
//! @brief Set necessity of lock every \a run with internal mutex
|
//! @brief Set necessity of lock every \a run with internal mutex
|
||||||
void needLockRun(bool need) {lockRun = need;}
|
void needLockRun(bool need) {lockRun = need;}
|
||||||
EVENT_HANDLER0(void, lock) {mutex_.lock();}
|
|
||||||
EVENT_HANDLER0(void, unlock) {mutex_.unlock();}
|
//! @brief Lock internal mutex
|
||||||
|
EVENT_HANDLER0(void, lock) const {thread_mutex.lock();}
|
||||||
|
|
||||||
|
//! @brief Unlock internal mutex
|
||||||
|
EVENT_HANDLER0(void, unlock) const {thread_mutex.unlock();}
|
||||||
|
|
||||||
//! @brief Returns internal mutex
|
//! @brief Returns internal mutex
|
||||||
PIMutex & mutex() {return mutex_;}
|
PIMutex & mutex() const {return thread_mutex;}
|
||||||
|
|
||||||
//! @brief Returns thread ID
|
//! @brief Returns thread ID
|
||||||
llong tid() const {return tid_;}
|
llong tid() const {return tid_;}
|
||||||
@@ -239,7 +243,7 @@ protected:
|
|||||||
int delay_, policy_;
|
int delay_, policy_;
|
||||||
llong tid_;
|
llong tid_;
|
||||||
void * data_;
|
void * data_;
|
||||||
mutable PIMutex mutex_;
|
mutable PIMutex thread_mutex;
|
||||||
PITimeMeasurer tmf_, tms_, tmr_;
|
PITimeMeasurer tmf_, tms_, tmr_;
|
||||||
PIThread::Priority priority_;
|
PIThread::Priority priority_;
|
||||||
ThreadFunc ret_func;
|
ThreadFunc ret_func;
|
||||||
|
|||||||
@@ -648,11 +648,11 @@ bool PITimer::stop(bool wait) {
|
|||||||
bool PITimer::waitForFinish(int timeout_msecs) {
|
bool PITimer::waitForFinish(int timeout_msecs) {
|
||||||
if (timeout_msecs < 0) {
|
if (timeout_msecs < 0) {
|
||||||
while (isRunning())
|
while (isRunning())
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
PITimeMeasurer tm;
|
PITimeMeasurer tm;
|
||||||
while (isRunning() && tm.elapsed_m() < timeout_msecs)
|
while (isRunning() && tm.elapsed_m() < timeout_msecs)
|
||||||
msleep(PIP_MIN_MSLEEP);
|
piMSleep(PIP_MIN_MSLEEP);
|
||||||
return tm.elapsed_m() < timeout_msecs;
|
return tm.elapsed_m() < timeout_msecs;
|
||||||
}
|
}
|
||||||
|
|||||||
161
main.cpp
161
main.cpp
@@ -1,123 +1,50 @@
|
|||||||
#include "pip.h"
|
#include "pip.h"
|
||||||
|
|
||||||
|
class PIThreadNotifier {
|
||||||
|
public:
|
||||||
|
PIThreadNotifier(): cnt(0) {}
|
||||||
|
|
||||||
|
void wait() {
|
||||||
|
m.lock();
|
||||||
|
while (cnt == 0) v.wait(m);
|
||||||
|
cnt--;
|
||||||
|
m.unlock();
|
||||||
|
}
|
||||||
|
void notifyOnce() {
|
||||||
|
m.lock();
|
||||||
|
cnt++;
|
||||||
|
v.notifyAll();
|
||||||
|
m.unlock();
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
ullong cnt;
|
||||||
|
PIMutex m;
|
||||||
|
PIConditionVariable v;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
|
PIThreadNotifier n;
|
||||||
PIVector<int> data(10, [](int i)->int{return i;});
|
int cnt1 = 0;
|
||||||
|
int cnt2 = 0;
|
||||||
piCout << data;
|
int cnt3 = 0;
|
||||||
|
PIThread t1([&n, &cnt1](){n.wait(); cnt1++; piMSleep(1);}, true);
|
||||||
PIThreadPoolLoop pool;
|
PIThread t2([&n, &cnt2](){n.wait(); cnt2++; piMSleep(2);}, true);
|
||||||
pool.setFunction([&](int i){
|
piCout << "created";
|
||||||
data[i] = data[i] + 10;
|
piMSleep(10);
|
||||||
});
|
piCout << "unlock" << cnt1 << cnt2 << cnt3;
|
||||||
pool.exec(0, data.size());
|
n.notifyOnce(); cnt3++;
|
||||||
|
piMSleep(10);
|
||||||
piCout << data;
|
piCout << "unlock" << cnt1 << cnt2 << cnt3;
|
||||||
|
n.notifyOnce(); cnt3++;
|
||||||
return 0;
|
piMSleep(10);
|
||||||
|
piCout << "run" << cnt1 << cnt2 << cnt3;
|
||||||
PIVector<int> x(20, [](int i) {return i;});
|
PIThread t3([&n, &cnt3](){n.notifyOnce(); cnt3++; piMSleep(1);}, true);
|
||||||
piCout << x;
|
piMSleep(20);
|
||||||
piCout << x.any([](int v) {return v == 10;});
|
t3.stop();
|
||||||
piCout << x.every([](int v) {return v > 0;});
|
piMSleep(100);
|
||||||
piCout << x.etries([](int v) {return v % 5 == 0;});
|
piCout << "exit" << cnt1 << cnt2 << cnt3;
|
||||||
piCout << x.indexWhere([](int v) {return v % 8 == 0;});
|
// m.unlock();
|
||||||
piCout << x.indexOf(4, -1);
|
// piMSleep(10);
|
||||||
piCout << x.lastIndexOf(1, 0);
|
|
||||||
piCout << x.lastIndexWhere([](int v) {return v % 8 == 0;});
|
|
||||||
PIVector<double> x2 = x.map<double>([](int v) {return v / 10.0;});
|
|
||||||
piCout << x2;
|
|
||||||
piCout << x.reduce<PIString>([](int v, PIString s){return s + PIString::fromNumber(v);});
|
|
||||||
piCout << x.removeWhere([](int v){return v % 2 == 0;});
|
|
||||||
piCout << x.getRange(8, 1);
|
|
||||||
piCout << x.getRange(8, 100);
|
|
||||||
|
|
||||||
piCout << "=====================";
|
|
||||||
|
|
||||||
PIDeque<int> y(20, [](int i) {return i;});
|
|
||||||
piCout << y;
|
|
||||||
piCout << y.any([](int v) {return v == 10;});
|
|
||||||
piCout << y.every([](int v) {return v > 0;});
|
|
||||||
piCout << y.etries([](int v) {return v % 5 == 0;});
|
|
||||||
piCout << y.indexWhere([](int v) {return v % 8 == 0;});
|
|
||||||
piCout << y.indexOf(4, -1);
|
|
||||||
piCout << y.lastIndexOf(1, 0);
|
|
||||||
piCout << y.lastIndexWhere([](int v) {return v % 8 == 0;});
|
|
||||||
PIDeque<double> y2 = y.map<double>([](int v) {return v / 10.0;});
|
|
||||||
piCout << y2;
|
|
||||||
piCout << y.reduce<PIString>([](int v, PIString s){return s + PIString::fromNumber(v);});
|
|
||||||
piCout << y.removeWhere([](int v){return v % 2 == 0;});
|
|
||||||
piCout << y.getRange(8, 1);
|
|
||||||
piCout << y.getRange(8, 100);
|
|
||||||
return 0; // TODO:
|
|
||||||
|
|
||||||
PIByteArray rnd;
|
|
||||||
rnd.resize(1024*1024, 'x');
|
|
||||||
PICLI cli(argc, argv);
|
|
||||||
PITimer tm;
|
|
||||||
cli.addArgument("connect", true);
|
|
||||||
cli.addArgument("name", true);
|
|
||||||
PICloudClient c("127.0.0.1:10101");
|
|
||||||
// c.setReopenEnabled(true);
|
|
||||||
PICloudServer s("127.0.0.1:10101");
|
|
||||||
PIVector<PICloudServer::Client *> clients;
|
|
||||||
CONNECTL(&tm, tickEvent, ([&](void *, int){
|
|
||||||
if (c.isConnected()) {
|
|
||||||
PIString str = "ping";
|
|
||||||
piCout << "[Client] send:" << str;
|
|
||||||
c.write(str.toByteArray());
|
|
||||||
}
|
|
||||||
if (s.isRunning()) {
|
|
||||||
for (auto cl : clients) {
|
|
||||||
if (cl->isOpened()) {
|
|
||||||
PIString str = "ping_S";
|
|
||||||
piCout << "[Server] send to" << cl << ":" << str;
|
|
||||||
cl->write(str.toByteArray());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
CONNECTL(&c, threadedReadEvent, ([&](uchar * readed, int size){
|
|
||||||
PIByteArray ba(readed, size);
|
|
||||||
if (size < 1024) {
|
|
||||||
PIString str = PIString(ba);
|
|
||||||
piCout << "[Client] data:" << str;
|
|
||||||
if (str == "ping_S") c.write(PIString("pong_S").toByteArray());
|
|
||||||
} else piCout << "[Client] blob:" << size;
|
|
||||||
}));
|
|
||||||
CONNECTL(&c, connected, ([](){piCout << "connected";}));
|
|
||||||
CONNECTL(&c, disconnected, ([](){piCout << "disconnected";}));
|
|
||||||
CONNECTL(&s, newConnection, ([&](PICloudServer::Client * cl){
|
|
||||||
piCout << "[Server] new client:" << cl;
|
|
||||||
clients << cl;
|
|
||||||
CONNECTL(cl, threadedReadEvent, ([&c, &s, cl, &rnd](uchar * readed, int size){
|
|
||||||
PIByteArray ba(readed, size);
|
|
||||||
PIString str = PIString(ba);
|
|
||||||
piCout << "[Server] data from" << cl << ":" << str;
|
|
||||||
if (str == "ping") {
|
|
||||||
cl->write(PIString("pong").toByteArray());
|
|
||||||
cl->write(rnd);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
CONNECTL(cl, closed, ([&clients, cl](){
|
|
||||||
cl->stop();
|
|
||||||
clients.removeAll(cl);
|
|
||||||
cl->deleteLater();
|
|
||||||
}));
|
|
||||||
cl->startThreadedRead();
|
|
||||||
}));
|
|
||||||
if (cli.hasArgument("name")) s.setServerName(cli.argumentValue("name"));
|
|
||||||
if (cli.hasArgument("connect")) {
|
|
||||||
c.setServerName(cli.argumentValue("connect"));
|
|
||||||
c.startThreadedRead();
|
|
||||||
} else {
|
|
||||||
s.startThreadedRead();
|
|
||||||
}
|
|
||||||
tm.start(1000);
|
|
||||||
PIKbdListener ls;
|
|
||||||
ls.enableExitCapture(PIKbdListener::F10);
|
|
||||||
ls.start();
|
|
||||||
WAIT_FOR_EXIT
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
73
main_picloud_test.cpp
Normal file
73
main_picloud_test.cpp
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#include "pip.h"
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char * argv[]) {
|
||||||
|
PIByteArray rnd;
|
||||||
|
rnd.resize(1024*1024, 'x');
|
||||||
|
PICLI cli(argc, argv);
|
||||||
|
PITimer tm;
|
||||||
|
cli.addArgument("connect", true);
|
||||||
|
cli.addArgument("name", true);
|
||||||
|
PICloudClient c("127.0.0.1:10101");
|
||||||
|
// c.setReopenEnabled(true);
|
||||||
|
PICloudServer s("127.0.0.1:10101");
|
||||||
|
PIVector<PICloudServer::Client *> clients;
|
||||||
|
CONNECTL(&tm, tickEvent, ([&](void *, int){
|
||||||
|
if (c.isConnected()) {
|
||||||
|
PIString str = "ping";
|
||||||
|
piCout << "[Client] send:" << str;
|
||||||
|
c.write(str.toByteArray());
|
||||||
|
}
|
||||||
|
if (s.isRunning()) {
|
||||||
|
for (auto cl : clients) {
|
||||||
|
if (cl->isOpened()) {
|
||||||
|
PIString str = "ping_S";
|
||||||
|
piCout << "[Server] send to" << cl << ":" << str;
|
||||||
|
cl->write(str.toByteArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
CONNECTL(&c, threadedReadEvent, ([&](uchar * readed, int size){
|
||||||
|
PIByteArray ba(readed, size);
|
||||||
|
if (size < 1024) {
|
||||||
|
PIString str = PIString(ba);
|
||||||
|
piCout << "[Client] data:" << str;
|
||||||
|
if (str == "ping_S") c.write(PIString("pong_S").toByteArray());
|
||||||
|
} else piCout << "[Client] blob:" << size;
|
||||||
|
}));
|
||||||
|
CONNECTL(&c, connected, ([](){piCout << "connected";}));
|
||||||
|
CONNECTL(&c, disconnected, ([](){piCout << "disconnected";}));
|
||||||
|
CONNECTL(&s, newConnection, ([&](PICloudServer::Client * cl){
|
||||||
|
piCout << "[Server] new client:" << cl;
|
||||||
|
clients << cl;
|
||||||
|
CONNECTL(cl, threadedReadEvent, ([&c, &s, cl, &rnd](uchar * readed, int size){
|
||||||
|
PIByteArray ba(readed, size);
|
||||||
|
PIString str = PIString(ba);
|
||||||
|
piCout << "[Server] data from" << cl << ":" << str;
|
||||||
|
if (str == "ping") {
|
||||||
|
cl->write(PIString("pong").toByteArray());
|
||||||
|
cl->write(rnd);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
CONNECTL(cl, closed, ([&clients, cl](){
|
||||||
|
cl->stop();
|
||||||
|
clients.removeAll(cl);
|
||||||
|
cl->deleteLater();
|
||||||
|
}));
|
||||||
|
cl->startThreadedRead();
|
||||||
|
}));
|
||||||
|
if (cli.hasArgument("name")) s.setServerName(cli.argumentValue("name"));
|
||||||
|
if (cli.hasArgument("connect")) {
|
||||||
|
c.setServerName(cli.argumentValue("connect"));
|
||||||
|
c.startThreadedRead();
|
||||||
|
} else {
|
||||||
|
s.startThreadedRead();
|
||||||
|
}
|
||||||
|
tm.start(1000);
|
||||||
|
PIKbdListener ls;
|
||||||
|
ls.enableExitCapture(PIKbdListener::F10);
|
||||||
|
ls.start();
|
||||||
|
WAIT_FOR_EXIT
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -88,7 +88,7 @@ TEST_F(ConditionVariable, wait_is_protected_unblock_when_notifyOne) {
|
|||||||
// Missing unlock
|
// Missing unlock
|
||||||
});
|
});
|
||||||
variable->notifyOne();
|
variable->notifyOne();
|
||||||
msleep(WAIT_THREAD_TIME_MS);
|
piMSleep(WAIT_THREAD_TIME_MS);
|
||||||
ASSERT_FALSE(m.tryLock());
|
ASSERT_FALSE(m.tryLock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ TEST_F(ConditionVariable, wait_condition_is_check_condition_when_notifyOne) {
|
|||||||
isConditionChecked = false;
|
isConditionChecked = false;
|
||||||
m.unlock();
|
m.unlock();
|
||||||
variable->notifyOne();
|
variable->notifyOne();
|
||||||
msleep(threadStartTime + 1);
|
piMSleep(threadStartTime + 1);
|
||||||
m.lock();
|
m.lock();
|
||||||
ASSERT_TRUE(isConditionChecked);
|
ASSERT_TRUE(isConditionChecked);
|
||||||
m.unlock();
|
m.unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user