当前位置: 首页 > news >正文

广东省农业农村厅职称评审优化网站要多少钱

广东省农业农村厅职称评审,优化网站要多少钱,网站建设摊销几年,建设工程施工合同样本此示例创建自定义线程池#xff0c;创建工作项和线程池计时器#xff0c;并将它们与清理组关联。该池由一个持久性线程组成。它演示了以下线程池函数的使用#xff1a; CloseThreadpool CloseThreadpoolCleanupGroupCloseThreadpoolCleanupGroupMembersCloseThreadpoolWait…此示例创建自定义线程池创建工作项和线程池计时器并将它们与清理组关联。该池由一个持久性线程组成。它演示了以下线程池函数的使用 CloseThreadpool CloseThreadpoolCleanupGroupCloseThreadpoolCleanupGroupMembersCloseThreadpoolWaitCreateThreadpoolCreateThreadpoolCleanupGroupCreateThreadpoolTimerCreateThreadpoolWaitCreateThreadpoolWorkInitializeThreadpoolEnvironmentSetThreadpoolCallbackCleanupGroupSetThreadpoolCallbackPoolSetThreadpoolThreadMaximumSetThreadpoolThreadMinimumSetThreadpoolTimerSetThreadpoolWaitSubmitThreadpoolWorkWaitForThreadpoolWaitCallbacks #include windows.h #include tchar.h #include stdio.h// // Thread pool wait callback function template // VOID CALLBACK MyWaitCallback(PTP_CALLBACK_INSTANCE Instance,PVOID Parameter,PTP_WAIT Wait,TP_WAIT_RESULT WaitResult) {// Instance, Parameter, Wait, and WaitResult not used in this example.UNREFERENCED_PARAMETER(Instance);UNREFERENCED_PARAMETER(Parameter);UNREFERENCED_PARAMETER(Wait);UNREFERENCED_PARAMETER(WaitResult);//// Do something when the wait is over.//_tprintf(_T(MyWaitCallback: wait is over.\n)); }// // Thread pool timer callback function template // VOID CALLBACK MyTimerCallback(PTP_CALLBACK_INSTANCE Instance,PVOID Parameter,PTP_TIMER Timer) {// Instance, Parameter, and Timer not used in this example.UNREFERENCED_PARAMETER(Instance);UNREFERENCED_PARAMETER(Parameter);UNREFERENCED_PARAMETER(Timer);//// Do something when the timer fires.//_tprintf(_T(MyTimerCallback: timer has fired.\n));}// // This is the thread pool work callback function. // VOID CALLBACK MyWorkCallback(PTP_CALLBACK_INSTANCE Instance,PVOID Parameter,PTP_WORK Work) {// Instance, Parameter, and Work not used in this example.UNREFERENCED_PARAMETER(Instance);UNREFERENCED_PARAMETER(Parameter);UNREFERENCED_PARAMETER(Work);BOOL bRet FALSE;//// Do something when the work callback is invoked.//{_tprintf(_T(MyWorkCallback: Task performed.\n));}return; }VOID DemoCleanupPersistentWorkTimer() {BOOL bRet FALSE;PTP_WORK work NULL;PTP_TIMER timer NULL;PTP_POOL pool NULL;PTP_WORK_CALLBACK workcallback MyWorkCallback;PTP_TIMER_CALLBACK timercallback MyTimerCallback;TP_CALLBACK_ENVIRON CallBackEnviron;PTP_CLEANUP_GROUP cleanupgroup NULL;FILETIME FileDueTime;ULARGE_INTEGER ulDueTime;UINT rollback 0;InitializeThreadpoolEnvironment(CallBackEnviron);//// Create a custom, dedicated thread pool.//pool CreateThreadpool(NULL);if (NULL pool) {_tprintf(_T(CreateThreadpool failed. LastError: %u\n),GetLastError());goto main_cleanup;}rollback 1; // pool creation succeeded//// The thread pool is made persistent simply by setting// both the minimum and maximum threads to 1.//SetThreadpoolThreadMaximum(pool, 1);bRet SetThreadpoolThreadMinimum(pool, 1);if (FALSE bRet) {_tprintf(_T(SetThreadpoolThreadMinimum failed. LastError: %u\n),GetLastError());goto main_cleanup;}//// Create a cleanup group for this thread pool.//cleanupgroup CreateThreadpoolCleanupGroup();if (NULL cleanupgroup) {_tprintf(_T(CreateThreadpoolCleanupGroup failed. LastError: %u\n), GetLastError());goto main_cleanup; }rollback 2; // Cleanup group creation succeeded//// Associate the callback environment with our thread pool.//SetThreadpoolCallbackPool(CallBackEnviron, pool);//// Associate the cleanup group with our thread pool.// Objects created with the same callback environment// as the cleanup group become members of the cleanup group.//SetThreadpoolCallbackCleanupGroup(CallBackEnviron,cleanupgroup,NULL);//// Create work with the callback environment.//work CreateThreadpoolWork(workcallback,NULL, CallBackEnviron);if (NULL work) {_tprintf(_T(CreateThreadpoolWork failed. LastError: %u\n),GetLastError());goto main_cleanup;}rollback 3; // Creation of work succeeded//// Submit the work to the pool. Because this was a pre-allocated// work item (using CreateThreadpoolWork), it is guaranteed to execute.//SubmitThreadpoolWork(work);//// Create a timer with the same callback environment.//timer CreateThreadpoolTimer(timercallback,NULL,CallBackEnviron);if (NULL timer) {_tprintf(_T(CreateThreadpoolTimer failed. LastError: %u\n),GetLastError());goto main_cleanup;}rollback 4; // Timer creation succeeded//// Set the timer to fire in one second.//ulDueTime.QuadPart (ULONGLONG) -(1 * 10 * 1000 * 1000);FileDueTime.dwHighDateTime ulDueTime.HighPart;FileDueTime.dwLowDateTime ulDueTime.LowPart;SetThreadpoolTimer(timer,FileDueTime,0,0);//// Delay for the timer to be fired//Sleep(1500);//// Wait for all callbacks to finish.// CloseThreadpoolCleanupGroupMembers also releases objects// that are members of the cleanup group, so it is not necessary // to call close functions on individual objects // after calling CloseThreadpoolCleanupGroupMembers.//CloseThreadpoolCleanupGroupMembers(cleanupgroup,FALSE,NULL);//// Already cleaned up the work item with the// CloseThreadpoolCleanupGroupMembers, so set rollback to 2.//rollback 2;goto main_cleanup;main_cleanup://// Clean up any individual pieces manually// Notice the fall-through structure of the switch.// Clean up in reverse order.//switch (rollback) {case 4:case 3:// Clean up the cleanup group members.CloseThreadpoolCleanupGroupMembers(cleanupgroup,FALSE, NULL);case 2:// Clean up the cleanup group.CloseThreadpoolCleanupGroup(cleanupgroup);case 1:// Clean up the pool.CloseThreadpool(pool);default:break;}return; }VOID DemoNewRegisterWait() {PTP_WAIT Wait NULL;PTP_WAIT_CALLBACK waitcallback MyWaitCallback;HANDLE hEvent NULL;UINT i 0;UINT rollback 0;//// Create an auto-reset event.//hEvent CreateEvent(NULL, FALSE, FALSE, NULL);if (NULL hEvent) {// Error Handlingreturn;}rollback 1; // CreateEvent succeededWait CreateThreadpoolWait(waitcallback,NULL,NULL);if(NULL Wait) {_tprintf(_T(CreateThreadpoolWait failed. LastError: %u\n),GetLastError());goto new_wait_cleanup;}rollback 2; // CreateThreadpoolWait succeeded//// Need to re-register the event with the wait object// each time before signaling the event to trigger the wait callback.//for (i 0; i 5; i ) {SetThreadpoolWait(Wait,hEvent,NULL);SetEvent(hEvent);//// Delay for the waiter thread to act if necessary.//Sleep(500);//// Block here until the callback function is done executing.//WaitForThreadpoolWaitCallbacks(Wait, FALSE);}new_wait_cleanup:switch (rollback) {case 2:// Unregister the wait by setting the event to NULL.SetThreadpoolWait(Wait, NULL, NULL);// Close the wait.CloseThreadpoolWait(Wait);case 1:// Close the event.CloseHandle(hEvent);default:break;}return; }int main( void) {DemoNewRegisterWait();DemoCleanupPersistentWorkTimer();return 0; } 相关话题 线程池
http://www.zqtcl.cn/news/262324/

相关文章:

  • 在线购物网站的设计阿里巴巴网站建设
  • 宿迁网站制作公司河北省建设工程协会网站
  • 美丽寮步网站建设做招聘的网站有哪些内容
  • 服装商店的网站建设要求企业所得税率
  • 南联网站建设公司注册企业查询
  • 商业网站的网址买网站服务器吗
  • 专业的单位网站开发网站开发和网页开发有什么区别
  • 电子商务网站建设 概念免费网页设计制作网站
  • 柳州做网站设计的公司游戏界面设计图片
  • 网站建设属于无形资产吗网站开发工程师 下载
  • 湖北城乡建设部网站首页推广电子商务网站的案例
  • 做地方网站如何盈利电脑上怎样进入中国建设银行网站
  • 网站建设初期问题常见wordpress 3.8页面伪静态化 html
  • wordpress字不能显示嘉兴优化网站公司
  • 免费行情网站大全下载wordpress访问要10多秒
  • 内蒙古生产建设兵团四师三十四团知青网站绵阳哪里可以做网站的地方
  • 网站建设找推推蛙wordpress 评论 字段
  • 河北保定网站建设石家庄网站建设找汉狮
  • 网站建设风险分析网站开发需多少钱
  • 苏州企业网站制作程序开发的步骤
  • 网站开发与维护竞赛深圳建设局官网站
  • 开发网站的费用属于什么费用高等院校网站建设方案
  • 建设化工网站的功能百度装修网站
  • 重庆大渡口营销型网站建设价格网站404 原因
  • 网网站建设公司咨询php asp jsp 网站
  • 遂宁北京网站建设微盟微商城官网
  • 惠州网站建设创业三明百度seo
  • 网站制作模板公司网站维护流程
  • 超炫网站模板友情链接交换教程
  • 物流公司做网站有用吗备案网站的黑名单