# "Thread-safe" adjective for use in Golang documentation

**URL:** <https://forum.golangbridge.org/t/thread-safe-adjective-for-use-in-golang-documentation/20618>\
**Category:** Technical Discussion\
**Created:** [September 18, 2020, 7:05am UTC](https://forum.golangbridge.org/t/thread-safe-adjective-for-use-in-golang-documentation/20618 "2020-09-18T07:05:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roman\_Leventov](https://forum.golangbridge.org/user_avatar/forum.golangbridge.org/roman_leventov/32/8450_2.png) [@Roman\_Leventov](https://forum.golangbridge.org/u/Roman_Leventov)\
**Post date:** [September 18, 2020, 7:05am UTC](https://forum.golangbridge.org/t/thread-safe-adjective-for-use-in-golang-documentation/20618/1 "2020-09-18T07:05:30Z")

</div>

“Thread-safe”, “[thread-safety](https://en.wikipedia.org/wiki/Thread_safety)” are standard computer science terms. “Thread-safe” is [commonly used](https://www.google.com/search?q=site%3Adocs.oracle.com%2Fen%2Fjava%2Fjavase%2F11%2F%20%22thread-safe%22) as an adjective or an adverb in the documentation comments for classes and methods in Java.

In the documentation for types and methods in Go, it feels unnatural to use this term because there are no “threads” in the Go execution model. “Goroutine-safe” feels contrived. “FooBar is not safe for use [calling] from concurrent goroutines” is very mouthful.

What is the preferred way to describe the concurrency guarantees (or the lack thereof) of a Go type or a method in the doc?

---

<div class="post-metadata">

**Author:** ![petrus](https://forum.golangbridge.org/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@petrus](https://forum.golangbridge.org/u/petrus)\
**Post date:** [September 18, 2020, 9:07am UTC](https://forum.golangbridge.org/t/thread-safe-adjective-for-use-in-golang-documentation/20618/2 "2020-09-18T09:07:37Z")

</div>

**safe for concurrent use**

Unless explicitly stated that it is safe for concurrent use, it is unsafe for concurrent use.

> [Package rand](https://golang.org/pkg/math/rand/)
> 
> The default Source is safe for concurrent use by multiple goroutines, but Sources created by NewSource are not.
> 
> Seed, unlike the Rand.Seed method, is safe for concurrent use.
> 
> Read, unlike the Rand.Read method, is safe for concurrent use.
> 
> Unlike the default Source used by top-level functions, this source is not safe for concurrent use by multiple goroutines.

---

<div class="post-metadata">

**Author:** ![system](https://forum.golangbridge.org/uploads/default/original/2X/5/5ad234f7c3dbc68b6cc72d338ce4f2973d9fd81c.png) [@system](https://forum.golangbridge.org/u/system)\
**Post date:** [December 17, 2020, 9:07am UTC](https://forum.golangbridge.org/t/thread-safe-adjective-for-use-in-golang-documentation/20618/3 "2020-12-17T09:07:37Z")

</div>

Closed on December 17, 2020, 9:07am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
