Close a session. This contacts any other processes associated with this session, if applicable. Blocks until all previous calls to Run have returned.
()
| 269 | // Close a session. This contacts any other processes associated with this |
| 270 | // session, if applicable. Blocks until all previous calls to Run have returned. |
| 271 | func (s *Session) Close() error { |
| 272 | s.mu.Lock() |
| 273 | defer s.mu.Unlock() |
| 274 | s.wg.Wait() |
| 275 | if s.c == nil { |
| 276 | return nil |
| 277 | } |
| 278 | status := newStatus() |
| 279 | C.TF_CloseSession(s.c, status.c) |
| 280 | if err := status.Err(); err != nil { |
| 281 | return err |
| 282 | } |
| 283 | C.TF_DeleteSession(s.c, status.c) |
| 284 | s.c = nil |
| 285 | return status.Err() |
| 286 | } |
| 287 | |
| 288 | // SessionOptions contains configuration information for a session. |
| 289 | type SessionOptions struct { |