switched to use a spin lock on behalf of a mutex

This commit is contained in:
2018-06-28 04:08:43 +00:00
parent 6519b1e4db
commit 40cdf684de
3 changed files with 15 additions and 29 deletions

View File

@ -36,18 +36,21 @@ static int test1 (void)
{
#if defined(QSE_LANG_CPP11)
QSE::TcpServerL<int(QSE::Socket*,QSE::SocketAddress*)> server (
([&server](QSE::Socket* clisock, QSE::SocketAddress* cliaddr) {
// workload by lambda
([&server](QSE::Socket* clisock, QSE::SocketAddress* cliaddr) {
qse_char_t buf[128];
qse_uint8_t bb[256];
while (!server.isStopRequested())
{
qse_printf (QSE_T("hello word..from %s\n"), cliaddr->toStrBuf(buf, QSE_COUNTOF(buf)));
if (clisock->receive (bb, QSE_COUNTOF(bb)) <= 0) break;
if (clisock->receive(bb, QSE_COUNTOF(bb)) <= 0) break;
}
qse_printf (QSE_T("bye..to %s\n"), cliaddr->toStrBuf(buf, QSE_COUNTOF(buf)));
return 0;
})
);
#else
QSE::TcpServerF<ClientHandler> server;