Github user huaiyun commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1028#discussion_r67449308
  
    --- Diff: lib/go/thrift/simple_server.go ---
    @@ -149,8 +151,10 @@ func (p *TSimpleServer) Serve() error {
     }
     
     func (p *TSimpleServer) Stop() error {
    -   p.quit <- struct{}{}
    -   p.serverTransport.Interrupt()
    +   if atomic.CompareAndSwapInt64(&p.stopped, 0, 1) {
    --- End diff --
    
    Actually no ticket, I am sorry.
    
    Itn64 is initialized to 0 automatically. It will be setted to 1 and return 
true when 0, return false with no change otherwise.
    
    I want to make the Stop() content actually executed only at the first 
calling, when stopped equals to 0, and repeated callings will be skipped.
    
    
    
    
    
    
    
------------------------------------------------------------------------------------------------------------
    姓名:尹智宇
    电话:13312111858
    邮箱:[email protected]
    地址:北京市海淀区毛纺路58号小米总参
    ________________________________
    发件人: James E. King, III <[email protected]>
    发送时间: 2016年6月17日 8:21
    收件人: apache/thrift
    抄送: 尹智宇; Author
    主题: Re: [apache/thrift] MOD: fix the blocked bug when call Stop() twice 
or more (#1028)
    
    
    In 
lib/go/thrift/simple_server.go<https://github.com/apache/thrift/pull/1028#discussion_r67445983>:
    
    > @@ -149,8 +151,10 @@ func (p *TSimpleServer) Serve() error {
    >  }
    >
    >  func (p *TSimpleServer) Stop() error {
    > -     p.quit <- struct{}{}
    > -     p.serverTransport.Interrupt()
    > +     if atomic.CompareAndSwapInt64(&p.stopped, 0, 1) {
    
    
    Do you want to be checking for a return value of 0 here instead of non-zero?
    
    ―
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on 
GitHub<https://github.com/apache/thrift/pull/1028/files/24d16aaaf20c97a944d22551a8a5215d830546c0#r67445983>,
 or mute the 
thread<https://github.com/notifications/unsubscribe/ATC7PLzGQ5BhZkP583E7Z2k-B8EKZZ8oks5qMehwgaJpZM4I3M67>.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to