1.

void TCPServer::start()

{

poco_assert (_stopped);

_stopped = false;

_thread.start(*this);

}

void Thread::start(Runnable& target)
{
startImpl(target);
} ... void ThreadImpl::startImpl(Runnable& target)
{
if (_pData->pRunnableTarget)
throw SystemException("thread already running"); pthread_attr_t attributes;
pthread_attr_init(&attributes); if (_pData->stackSize != )
{
if ( != pthread_attr_setstacksize(&attributes, _pData->stackSize))
{
pthread_attr_destroy(&attributes);
throw SystemException("cannot set thread stack size");
}
} _pData->pRunnableTarget = ⌖
if (pthread_create(&_pData->thread, &attributes, runnableEntry, this))
{
_pData->pRunnableTarget = ;
pthread_attr_destroy(&attributes);
throw SystemException("cannot start thread");
}
pthread_attr_destroy(&attributes); if (_pData->policy == SCHED_OTHER)
{
if (_pData->prio != PRIO_NORMAL_IMPL)
{
struct sched_param par;
par.sched_priority = mapPrio(_pData->prio, SCHED_OTHER);
if (pthread_setschedparam(_pData->thread, SCHED_OTHER, &par))
throw SystemException("cannot set thread priority");
}
}
else
{
struct sched_param par;
par.sched_priority = mapPrio(_pData->prio, _pData->policy);
if (pthread_setschedparam(_pData->thread, _pData->policy, &par))
throw SystemException("cannot set thread priority");
}
}
... void* ThreadImpl::runnableEntry(void* pThread)
{
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread)); #if defined(POCO_OS_FAMILY_UNIX)
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset, SIGQUIT);
sigaddset(&sset, SIGTERM);
sigaddset(&sset, SIGPIPE);
pthread_sigmask(SIG_BLOCK, &sset, );
#endif ThreadImpl* pThreadImpl = reinterpret_cast<ThreadImpl*>(pThread);
AutoPtr<ThreadData> pData = pThreadImpl->_pData;
try
{
pData->pRunnableTarget->run();
}
catch (Exception& exc)
{
ErrorHandler::handle(exc);
}
catch (std::exception& exc)
{
ErrorHandler::handle(exc);
}
catch (...)
{
ErrorHandler::handle();
} pData->pRunnableTarget = ;
pData->done.set();
return ;
}

https://codeload.github.com/JetMeta/ZPoco/zip/master

第16月第10天 poco target的更多相关文章

  1. 第10月第10天 git

    1. 已经用 git commit  提交了代码. 此命令可以用来回退到任意版本:git reset --hard  commitid https://www.cnblogs.com/qufanblo ...

  2. ubuntu 16.04(Windows 10双系统+grub引导)无法进入tt1~tt6(NVIDIA驱动安装相关-黑屏,login loop,分辨率)

    目录 前言回顾 最终解决: 0.关闭x服务 1.禁用nouveau 2.加入 3.更新 4.查找匹配驱动 5.选择推荐版本 6.等待安装后重启,nvidia-smi查看是否安装成功,或者lsmod | ...

  3. 薅羊毛? 月入10万? | 这是自动化测试老司机的特长--Python自动化带你薅视频红包,一个都不放过!

    一.目标场景 如今短视频横行的时代,以某短视频为首的,背后依靠着强大的资金后盾,疯狂地对平台用户进行红包轰炸. ​ 与传统的红包不一样,视频红包包含位置的不确定性.大小不确定性.元素 ID 的不确定性 ...

  4. 第16月第12天 CABasicAnimation 旋转加速

    1. ; double duration = 10.0f; ; i<count; i++) { //旋转动画 CABasicAnimation *anima3 = [CABasicAnimati ...

  5. 第16月第8天 NSInvocation存储 函数指针 va_arg lldb

    1.NSInvocation存储 -(void)setInvok:(id)target sel:(SEL)sel key:(id)key { if(!target) return; NSMethodS ...

  6. LeetCode 16 3Sum Closest (最接近target的3个数之和)

    题目链接 https://leetcode.com/problems/3sum-closest/?tab=Description     Problem : 找到给定数组中a+b+c 最接近targe ...

  7. Ubuntu 14.04 16.04 17.10 + Win10 双系统安装记录 + 分区大小选择办法

    安装了N遍,重要的东西在此记录. 参考了 http://www.libinx.com/2017/five-steps-win10-ubuntu-dual-boot/ 忠告:为了让日后喘气能匀呼些,要选 ...

  8. 第31月第10天 tableview头部空白 Other Linker Flags rtmp

    1.ios10 tableview头部空白 if (@available(iOS 11.0, *)) { self.tableView.contentInsetAdjustmentBehavior = ...

  9. Connect To Ubuntu 16.04 / 17.10 / 18.04 Desktop Via Remote Desktop Connection (RDP) With Xrdp

    [1] https://websiteforstudents.com/connect-to-ubuntu-16-04-17-10-18-04-desktop-via-remote-desktop-co ...

随机推荐

  1. zabbix2.2 - FromDual.MySQL.check" became not supported

    升级zabbix后发现zabbix server日志中多个实例报错如下: 27974:20171227:113001.724 item "实例name:FromDual.MySQL.chec ...

  2. (C++)关于i++和i++的左值、右值问题

    1.什么是左值和右值? 左值就是出现在表达式左边的值(等号左边),可以被改变,他是存储数据值的那块内存的地址,也称为变量的地址: 右值是指存储在某内存地址中的数据,也称为变量的数据. 左值可以作为右值 ...

  3. [IOI2018]会议——分治+线段树

    题目链接: [IOI2018]meetings 题目大意:有$n$座山峰,每座山峰有一个高度,有$q$次询问,每次需要确定一个开会山峰使$[l,r]$所有山峰上的人都前往开会山峰,一个山峰的人去开会的 ...

  4. length、length()、size()区别 List与String相互转换

      字符串 数组 List对象 定义 String str = ""; String[] s = new String[5]; char[] s; List<String&g ...

  5. MT【239】离心率最大

    已知点$A$为椭圆$\dfrac{x^2}{a^2}+\dfrac{y^2}{b^2}=1(a>b>0)$的左顶点,$O$为坐标原点,过椭圆的右焦点$F$作垂直于$x$轴的直线$l$.若直 ...

  6. 【BZOJ2142】礼物(拓展卢卡斯定理)

    [BZOJ2142]礼物(拓展卢卡斯定理) 题面 BZOJ 洛谷 题解 显然如果\(\sum w_i>n\)无解. 否则答案就是:\(\displaystyle \prod_{i=1}^m{n- ...

  7. 【CF715E】Complete the Permutations(容斥,第一类斯特林数)

    [CF715E]Complete the Permutations(容斥,第一类斯特林数) 题面 CF 洛谷 给定两个排列\(p,q\),但是其中有些位置未知,用\(0\)表示. 现在让你补全两个排列 ...

  8. Android DownloadManager 的使用

    分类: android 技巧2013-05-28 10:32 3278人阅读 评论(1) 收藏 举报   目录(?)[+]   从Android 2.3(API level 9)开始Android用系 ...

  9. 「loj3057」「hnoi2019」校园旅行

    题目 一个n个点m条边的无向图,每个点有0 / 1 的标号; 有q个询问,每次询问(u,v)直接是否存在回文路径(可以经过重复的点和边); $1 \le n \le 5 \times 10^3  , ...

  10. A1056. Mice and Rice

    Mice and Rice is the name of a programming contest in which each programmer must write a piece of co ...