Start 开始运行消息队列
()
| 132 | |
| 133 | // Start 开始运行消息队列 |
| 134 | func (q *queue) Start() { |
| 135 | c := make(chan os.Signal, 1) |
| 136 | signal.Notify(c, os.Interrupt, syscall.SIGTERM) |
| 137 | // Block until a signal is received. |
| 138 | select { |
| 139 | case <-q.done: |
| 140 | qlog.Info("closing chain33 done") |
| 141 | //atomic.StoreInt32(&q.isClose, 1) |
| 142 | break |
| 143 | case <-q.interrupt: |
| 144 | qlog.Info("closing chain33") |
| 145 | //atomic.StoreInt32(&q.isClose, 1) |
| 146 | break |
| 147 | case s := <-c: |
| 148 | qlog.Info("Got signal:", "s", s) |
| 149 | //atomic.StoreInt32(&q.isClose, 1) |
| 150 | break |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | func (q *queue) isClosed() bool { |
| 155 | return atomic.LoadInt32(&q.isClose) == 1 |