.. _stdlib_jobque_boost: ================================== 作业和线程的 Boost 包 ================================== .. include:: detail/jobque_boost.rst JOBQUE boost 模块实现了 :ref:`JOBQUE `附带的辅助宏和函数的集合。 所有函数和符号都在 “jobque_boost” 模块中,使用 require 来访问它。 :: require daslib/jobque_boost ++++++++++++++++++++ Function annotations ++++++++++++++++++++ .. _handle-jobque_boost-NewJobMacro: .. das:attribute:: NewJobMacro 此宏处理 `new_job` 和 `new_thread` 调用。 调用相应地替换为`new_job_invoke`和`new_thread_invoke`。 将为 Lambda 生成克隆 infastructure,并在新上下文中调用该 lambda。 +++++++++++ 调用 +++++++++++ * :ref:`new_job (l:lambda\<\> -const) : void ` * :ref:`new_thread (l:lambda\<\> -const) : void ` .. _function-_at_jobque_boost_c__c_new_job__at_: .. das:function:: new_job(l: lambda<>) +--------+-------------+ +argument+argument type+ +========+=============+ +l +lambda<> + +--------+-------------+ 创建新作业。 * 从当前上下文克隆新上下文。 * Lambda 被克隆到新上下文。 * 新作业已添加到作业队列中。 * 调用新作业后,将在作业线程上的新上下文上调用 Lambda。 请注意,如果 job-que 存在,则永远不会调用此函数。 .. _function-_at_jobque_boost_c__c_new_thread__at_: .. das:function:: new_thread(l: lambda<>) +--------+-------------+ +argument+argument type+ +========+=============+ +l +lambda<> + +--------+-------------+ 创建新线程 * 从当前上下文克隆新上下文。 * Lambda 被克隆到新上下文。 * 创建新线程。 * lambda 在新线程上的新上下文上调用。 请注意,如果存在 job-que,则永远不会调用 +++++++++ 迭代 +++++++++ * :ref:`for_each (channel:jobque::Channel? const;blk:block\<(res:auto(TT) const#):void\> const) : auto ` * :ref:`each (channel:jobque::Channel? -const;tinfo:auto(TT) const) : auto ` .. _function-_at_jobque_boost_c__c_for_each_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_res_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: for_each(channel: Channel? const; blk: block<(res:auto(TT) const#):void> const) for_each returns auto .. warning:: This function is deprecated. +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(res:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从通道读取 Input(按推送顺序)并在每个 Importing 上调用 Block。 通道耗尽后停止(内部 Entry 计数器为 0) 这可能会同时发生在多个线程或作业上。 .. _function-_at_jobque_boost_c__c_each_1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CY_ls_TT_gr_.: .. das:function:: each(channel: Channel?; tinfo: auto(TT) const) each returns auto .. warning:: 此函数已弃用。 +--------+-------------------------------------------------+ +argument+argument type + +========+=================================================+ +channel + :ref:`jobque::Channel ` ?+ +--------+-------------------------------------------------+ +tinfo +auto(TT) const + +--------+-------------------------------------------------+ 这个迭代器用于按照 Channel 的推送顺序迭代 Channel。 一旦 Channel 耗尽,iterator 就会停止(内部 entry counter 为 0) 迭代可以同时发生在多个线程或作业上。 ++++++++++++ 传递数据 ++++++++++++ * :ref:`push_clone (channel:jobque::Channel? const;data:auto(TT) const) : auto ` * :ref:`push (channel:jobque::Channel? const;data:auto? const) : auto ` .. _function-_at_jobque_boost_c__c_push_clone_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CY_ls_TT_gr_.: .. das:function:: push_clone(channel: Channel? const; data: auto(TT) const) push_clone returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +data +auto(TT) const + +--------+-------------------------------------------------------+ 克隆数据并将值推送到通道(在末尾) .. _function-_at_jobque_boost_c__c_push_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__C1_ls_._gr__qm_: .. das:function:: push(channel: Channel? const; data: auto? const) push returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +data +auto? const + +--------+-------------------------------------------------------+ 将值推送到通道(末尾) ++++++++++++++++++++++++ 内部捕获详细信息 ++++++++++++++++++++++++ * :ref:`capture_jobque_channel (ch:jobque::Channel? const) : jobque::Channel? ` * :ref:`capture_jobque_job_status (js:jobque::JobStatus? const) : jobque::JobStatus? ` * :ref:`release_capture_jobque_channel (ch:jobque::Channel? const) : void ` * :ref:`release_capture_jobque_job_status (js:jobque::JobStatus? const) : void ` .. _function-_at_jobque_boost_c__c_capture_jobque_channel_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm_: .. das:function:: capture_jobque_channel(ch: Channel? const) capture_jobque_channel returns :ref:`jobque::Channel ` ? +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +ch + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ 此函数用于捕获 jobque 使用的通道。 .. _function-_at_jobque_boost_c__c_capture_jobque_job_status_C1_ls_H_ls_jobque_c__c_JobStatus_gr__gr__qm_: .. das:function:: capture_jobque_job_status(js: JobStatus? const) capture_jobque_job_status returns :ref:`jobque::JobStatus ` ? +--------+-----------------------------------------------------------+ +argument+argument type + +========+===========================================================+ +js + :ref:`jobque::JobStatus ` ? const+ +--------+-----------------------------------------------------------+ 此函数用于捕获 jobque 使用的作业状态。 .. _function-_at_jobque_boost_c__c_release_capture_jobque_channel_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm_: .. das:function:: release_capture_jobque_channel(ch: Channel? const) +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +ch + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ 该函数用于释放 jobque 使用的频道。 .. _function-_at_jobque_boost_c__c_release_capture_jobque_job_status_C1_ls_H_ls_jobque_c__c_JobStatus_gr__gr__qm_: .. das:function:: release_capture_jobque_job_status(js: JobStatus? const) +--------+-----------------------------------------------------------+ +argument+argument type + +========+===========================================================+ +js + :ref:`jobque::JobStatus ` ? const+ +--------+-----------------------------------------------------------+ 该函数用于释放 JobQue 使用的 Job Status。 +++++++++++++ 未分类 +++++++++++++ .. _function-_at_jobque_boost_c__c_capture_jobque_lock_box_C1_ls_H_ls_jobque_c__c_LockBox_gr__gr__qm_: .. das:function:: capture_jobque_lock_box(js: LockBox? const) capture_jobque_lock_box returns :ref:`jobque::LockBox ` ? +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +js + :ref:`jobque::LockBox ` ? const+ +--------+-------------------------------------------------------+ 此函数用于捕获 Jobque 使用的锁箱。 .. _function-_at_jobque_boost_c__c_release_capture_jobque_lock_box_C1_ls_H_ls_jobque_c__c_LockBox_gr__gr__qm_: .. das:function:: release_capture_jobque_lock_box(js: LockBox? const) +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +js + :ref:`jobque::LockBox ` ? const+ +--------+-------------------------------------------------------+ 此函数用于释放 Jobque 使用的 lock box。 .. _function-_at_jobque_boost_c__c_gather_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_arg_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: gather(ch: Channel? const; blk: block<(arg:auto(TT) const#):void> const) gather returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +ch + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(arg:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从通道读取 Input(按推送顺序)并在每个 Importing 上调用 Block。 之后 input 被消耗 .. _function-_at_jobque_boost_c__c_gather_ex_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_arg;info;ctx_gr_0_ls_C_hh_Y_ls_TT_gr_.;C1_ls_CH_ls_rtti_c__c_TypeInfo_gr__gr__qm_;H_ls_rtti_c__c_Context_gr__gr_1_ls_v_gr__builtin_: .. das:function:: gather_ex(ch: Channel? const; blk: block<(arg:auto(TT) const#;info:TypeInfo const? const;var ctx:Context):void> const) gather_ex returns auto +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +argument+argument type + +========+=========================================================================================================================================================+ +ch + :ref:`jobque::Channel ` ? const + +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ +blk +block<(arg:auto(TT) const#;info: :ref:`rtti::TypeInfo ` const? const;ctx: :ref:`rtti::Context ` ):void> const+ +--------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ 从通道读取 Input(按推送顺序)并在每个 Importing 上调用 Block。 之后 input 被消耗 .. _function-_at_jobque_boost_c__c_gather_and_forward_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_arg_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: gather_and_forward(ch: Channel? const; toCh: Channel? const; blk: block<(arg:auto(TT) const#):void> const) gather_and_forward returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +ch + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +toCh + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(arg:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从通道读取 Input(按推送顺序)并在每个 Importing 上调用 Block。 之后 input 被消耗 .. _function-_at_jobque_boost_c__c_peek_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_arg_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: peek(ch: Channel? const; blk: block<(arg:auto(TT) const#):void> const) peek returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +ch + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(arg:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从通道读取 Input(按推送顺序)并在每个 Importing 上调用 Block。 之后,不消耗 input .. _function-_at_jobque_boost_c__c_for_each_clone_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_res_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: for_each_clone(channel: Channel? const; blk: block<(res:auto(TT) const#):void> const) for_each_clone returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(res:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从通道读取 Input(按推送顺序)并在每个 Importing 上调用 Block。 通道耗尽后停止(内部 Entry 计数器为 0) 这可能会同时发生在多个线程或作业上。 .. _function-_at_jobque_boost_c__c_pop_one_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_res_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: pop_one(channel: Channel? const; blk: block<(res:auto(TT) const#):void> const) pop_one returns auto .. warning:: This function is deprecated. +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(res:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从 Channel 中读取一个命令 .. _function-_at_jobque_boost_c__c_pop_and_clone_one_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CN_ls_res_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: pop_and_clone_one(channel: Channel? const; blk: block<(res:auto(TT) const#):void> const) pop_and_clone_one returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(res:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从 Channel 中读取一个命令 .. _function-_at_jobque_boost_c__c_push_batch_clone_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__C1_ls_Y_ls_TT_gr_._gr_A: .. das:function:: push_batch_clone(channel: Channel? const; data: array const) push_batch_clone returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +data +array const + +--------+-------------------------------------------------------+ 克隆数据并将值推送到通道(在末尾) .. _function-_at_jobque_boost_c__c_push_batch_C1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__C1_ls_1_ls_._gr__qm__gr_A: .. das:function:: push_batch(channel: Channel? const; data: array const) push_batch returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +channel + :ref:`jobque::Channel ` ? const+ +--------+-------------------------------------------------------+ +data +array const + +--------+-------------------------------------------------------+ 将值推送到通道(在末尾) .. _function-_at_jobque_boost_c__c_set_C1_ls_H_ls_jobque_c__c_LockBox_gr__gr__qm__CY_ls_TT_gr_.: .. das:function:: set(box: LockBox? const; data: auto(TT) const) set returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +box + :ref:`jobque::LockBox ` ? const+ +--------+-------------------------------------------------------+ +data +auto(TT) const + +--------+-------------------------------------------------------+ 将值设置为锁箱 .. _function-_at_jobque_boost_c__c_set_C1_ls_H_ls_jobque_c__c_LockBox_gr__gr__qm__C1_ls_._gr__qm_: .. das:function:: set(box: LockBox? const; data: auto? const) set returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +box + :ref:`jobque::LockBox ` ? const+ +--------+-------------------------------------------------------+ +data +auto? const + +--------+-------------------------------------------------------+ 将值设置为锁箱 .. _function-_at_jobque_boost_c__c_get_C1_ls_H_ls_jobque_c__c_LockBox_gr__gr__qm__CN_ls_res_gr_0_ls_C_hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: get(box: LockBox? const; blk: block<(res:auto(TT) const#):void> const) get returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +box + :ref:`jobque::LockBox ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(res:auto(TT) const#):void> const + +--------+-------------------------------------------------------+ 从锁箱中读取值并调用其上的块 .. _function-_at_jobque_boost_c__c_update_C1_ls_H_ls_jobque_c__c_LockBox_gr__gr__qm__CN_ls_res_gr_0_ls__hh_Y_ls_TT_gr_._gr_1_ls_v_gr__builtin_: .. das:function:: update(box: LockBox? const; blk: block<(var res:auto(TT)#):void> const) update returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +box + :ref:`jobque::LockBox ` ? const+ +--------+-------------------------------------------------------+ +blk +block<(res:auto(TT)#):void> const + +--------+-------------------------------------------------------+ 更新锁定框中的值,并调用其上的代码块 .. _function-_at_jobque_boost_c__c_clear_C1_ls_H_ls_jobque_c__c_LockBox_gr__gr__qm__CY_ls_TT_gr_.: .. das:function:: clear(box: LockBox? const; type_: auto(TT) const) clear returns auto +--------+-------------------------------------------------------+ +argument+argument type + +========+=======================================================+ +box + :ref:`jobque::LockBox ` ? const+ +--------+-------------------------------------------------------+ +type_ +auto(TT) const + +--------+-------------------------------------------------------+ 从锁框中清除值 .. _function-_at_jobque_boost_c__c_each_clone_1_ls_H_ls_jobque_c__c_Channel_gr__gr__qm__CY_ls_TT_gr_.: .. das:function:: each_clone(channel: Channel?; tinfo: auto(TT) const) each_clone returns auto +--------+-------------------------------------------------+ +argument+argument type + +========+=================================================+ +channel + :ref:`jobque::Channel ` ?+ +--------+-------------------------------------------------+ +tinfo +auto(TT) const + +--------+-------------------------------------------------+ 该迭代器用于按照通道推送的顺序对通道进行迭代。一旦通道耗尽(内部入口计数器为 0), ,迭代器就会停止。 迭代可以同时在多个线程或工作上进行。