Skip to content

Commit

Permalink
Document that Session is concurrency safe.
Browse files Browse the repository at this point in the history
Fixes #156.
  • Loading branch information
niemeyer committed Sep 30, 2015
1 parent c279dec commit 42f1143
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//
// New sessions are typically created by calling session.Copy on the
// initial session obtained at dial time. These new sessions will share
// the same cluster information and connection cache, and may be easily
// the same cluster information and connection pool, and may be easily
// handed into other methods and functions for organizing logic.
// Every session created must have its Close method called at the end
// of its life time, so its resources may be put back in the pool or
Expand Down
6 changes: 6 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ const (
// When changing the Session type, check if newSession and copySession
// need to be updated too.

// Session represents a communication session with the database.
//
// All Session methods are concurrency-safe and may be called from multiple
// goroutines. In all session modes but Eventual, using the session from
// multiple goroutines will cause them to share the same underlying socket.
// See the documentation on Session.SetMode for more details.
type Session struct {
m sync.RWMutex
cluster_ *mongoCluster
Expand Down

0 comments on commit 42f1143

Please sign in to comment.