goroutines

package
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 14 Imported by: 0

README

サンプルリスト

このディレクトリには以下のサンプルがあります。

file example name note
nonstop.go goroutines_nonstop ゴルーチンを待ち合わせ無しで走らせるサンプルです
withdonechannel.go goroutines_with_done_channel doneチャネルを用いて待ち合わせを行うサンプルです
withwaitgroup.go goroutines_with_waitgroup sync.WaitGroupを用いて待ち合わせを行うパターンです
withcontextcancel.go goroutines_with_context_cancel context.Contextを用いて待ち合わせを行うサンプルです
withcontexttimeout.go goroutines_with_context_timeout context.Contextを用いてタイムアウト付きで待ち合わせを行うサンプルです
withcontextdeadline.go goroutines_with_context_deadline context.Context::WithDeadline を使ったサンプルです
selectnilchan1.go goroutines_select_nil_chan_1 select ステートメントで nil チャネル を使って選択されるチャネルの有効・無効を切り替えるサンプルです (1)
selectnilchan2.go goroutines_select_nil_chan_2 select ステートメントで nil チャネル を使って選択されるチャネルの有効・無効を切り替えるサンプルです (2)
usingchansemaphore.go goroutines_using_chan_semaphore チャネルでセマフォの動作を行わせるサンプルです
usingmutex.go goroutines_using_mutex sync.Mutex を利用したサンプルです

Documentation

Overview

Package goroutines -- ゴルーチンについてのサンプルが配置されているパッケージです。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegister

func NewRegister() mapping.Register

NewRegister -- このパッケージ用のサンプルを登録する mapping.Register を生成します。

func NonStop

func NonStop() error

NonStop -- ゴルーチンを待ち合わせ無しで走らせるサンプルです.

投げっぱなしのゴルーチンを作る場合に使います。 通常待ち合わせ無しの非同期処理は行うべきではありません。

func SelectNilChan1

func SelectNilChan1() error

SelectNilChan1 -- select ステートメントで nil チャネル を使って選択されるチャネルの有効・無効を切り替えるサンプルです (1).

func SelectNilChan2

func SelectNilChan2() error

SelectNilChan2 -- select ステートメントで nil チャネル を使って選択されるチャネルの有効・無効を切り替えるサンプルです (2).

func UsingChanSemaphore

func UsingChanSemaphore() error

UsingChanSemaphore -- チャネルでセマフォの動作を行わせるサンプルです.

REFERENCES::

func UsingMutex

func UsingMutex() error

UsingMutex -- sync.Mutex を利用したサンプルです

func WithContextCancel

func WithContextCancel() error

WithContextCancel -- context.Contextを用いて待ち合わせを行うサンプルです.

func WithContextDeadline

func WithContextDeadline() error

WithContextDeadline -- context.WithDeadline を使ったサンプルです

func WithContextTimeout

func WithContextTimeout() error

WithContextTimeout -- context.Contextを用いてタイムアウト付きで待ち合わせを行うサンプルです

func WithDoneChannel

func WithDoneChannel() error

WithDoneChannel -- doneチャネルを用いて待ち合わせを行うサンプルです.

func WithWaitGroup

func WithWaitGroup() error

WithWaitGroup -- sync.WaitGroupを用いて待ち合わせを行うパターンです.

Types

This section is empty.

Directories

Path Synopsis
Package chansemaphore は、チャネルでセマフォの動作を実現するサンプルが配置されています
Package chansemaphore は、チャネルでセマフォの動作を実現するサンプルが配置されています
binarysemaphore
Package binarysemaphore は、チャネルでバイナリセマフォを表現しています.
Package binarysemaphore は、チャネルでバイナリセマフォを表現しています.
countingsemaphore
Package countingsemaphore は、チャネルで計数セマフォを表現しています.
Package countingsemaphore は、チャネルで計数セマフォを表現しています.
Package leak -- ゴルーチンリークについてのサンプルが配置されているパッケージです。
Package leak -- ゴルーチンリークについてのサンプルが配置されているパッケージです。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL