创建默认长度的队列
()
| 123 | |
| 124 | // 创建默认长度的队列 |
| 125 | func NewEventQueue() EventQueue { |
| 126 | |
| 127 | return &eventQueue{ |
| 128 | Pipe: NewPipe(), |
| 129 | |
| 130 | // 默认的崩溃捕获打印 |
| 131 | onPanic: func(raw interface{}, queue EventQueue) { |
| 132 | |
| 133 | fmt.Printf("%s: %v \n%s\n", time.Now().Format("2006-01-02 15:04:05"), raw, string(debug.Stack())) |
| 134 | debug.PrintStack() |
| 135 | }, |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | // 在会话对应的Peer上的事件队列中执行callback,如果没有队列,则马上执行 |
| 140 | func SessionQueuedCall(ses Session, callback func()) { |