在pthread中,如何使线程等待信号

时间:2017-07-26 11:35:52

标签: c pthreads

我的目标是创建一个可重用的线程,而不是在到达线程函数末尾时终止的线程。

这是我用pthreads尝试实现的伪代码:

select * 
  from 
     ( select f85
            , f86
            , f87
            , f88 
            , v1_position_id 
            , v1_companyuser_id 
            , v89.position_value f89 
         from 
            ( select f85
                   , f86
                   , f87 
                   , v1_position_id 
                   , v1_companyuser_id 
                   , v88.position_value f88 
                from 
                   ( select f85
                          , f86 
                          , v1_position_id 
                          , v1_companyuser_id 
                          , v87.position_value f87 
                       from 
                          ( select f85 
                                 , v1_position_id 
                                 , v1_companyuser_id 
                                 , v86.position_value f86 
                              from
                                 ( SELECT v1.position_id v1_position_id 
                                        , v1.companyuser_id v1_companyuser_id 
                                        , v1.position_value f85 
                                     FROM all_position_template_with_data v1 
                                    WHERE v1.position_id = 25 
                                      AND companyuser_id = 1 
                                      AND position_template_id = 85
                                 ) v1 
                              join all_position_template_with_data v86 
                                on v1_position_id = v86.position_id 
                               AND v1_companyuser_id = v86.companyuser_id 
                               AND v86.position_template_id = 86 
                          ) v86 
                       join all_position_template_with_data v87 
                         on v1_position_id = v87.position_id 
                        AND v1_companyuser_id = v87.companyuser_id 
                        AND v87.position_template_id = 87 
                   ) v87 
                join all_position_template_with_data v88 
                   on v1_position_id = v88.position_id 
                  AND v1_companyuser_id = v88.companyuser_id 
                  AND v88.position_template_id = 88 
            ) v88
         join all_position_template_with_data v89 
           on v1_position_id = v89.position_id 
          AND v1_companyuser_id = v89.companyuser_id 
          AND v89.position_template_id = 89 
     ) v89

我过去使用了win32函数waitForSingleObject以及一个事件,并且我不知道如何使用pthreads实现这种行为。

感谢您的帮助

0 个答案:

没有答案