You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2019/04/19 10:18:26 UTC

[GitHub] [incubator-brpc] miniframework opened a new issue #739: bthread_join ret errno Sometimes 0 , Sometimes 11.

miniframework opened a new issue #739: bthread_join  ret errno Sometimes 0 , Sometimes 11.
URL: https://github.com/apache/incubator-brpc/issues/739
 
 
   
    36 void* check_sleep() {
    46     while(true) {
    47       std::cout << "while" << std::endl;
    48       if (bthread_usleep(10) < 0) {
    49            if (errno == ESTOP) {
    50                std::cout << "ESTOP" << std::endl;
    51                break;
    52            }
    53            std::cout << "exit"<<std::endl;
    54            break;
    55       }
    56     }
    57 
    58     return NULL;
    59 }
    61 int main() {
    64     bthread_start_urgent(&th2, NULL,  check_sleep, (void*)0);
    84     sleep(1);
    85     bthread_stop(th2);
    87     int ret = bthread_join(th2, NULL);
    88     std::cout << "ret:" << errno << " " << strerror(errno) << std::endl;
   }
   
   output :
   Sometimes:
   
   while
   while
   while
   ESTOP
   ret:0 Success
   
   ----------------------------------------------
   sometimes :
   
   while
   while
   while
   ESTOP
   ret:11 Resource temporarily unavailable
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org