doc: Remove 'concurrent-safe' comments from most of non-global functions

This commit is contained in:
Hajime Hoshi 2017-04-18 01:33:03 +09:00
parent 4d3ad434b3
commit 858824821f
2 changed files with 0 additions and 44 deletions

View File

@ -271,8 +271,6 @@ func (c *Context) Update() error {
// SampleRate returns the sample rate. // SampleRate returns the sample rate.
// All audio source must have the same sample rate. // All audio source must have the same sample rate.
//
// This function is concurrent-safe.
func (c *Context) SampleRate() int { func (c *Context) SampleRate() int {
return c.sampleRate return c.sampleRate
} }
@ -325,8 +323,6 @@ type Player struct {
// //
// NewPlayer tries to rewind src by calling Seek to get the current position. // NewPlayer tries to rewind src by calling Seek to get the current position.
// NewPlayer returns error when the Seek returns error. // NewPlayer returns error when the Seek returns error.
//
// This function is concurrent-safe.
func NewPlayer(context *Context, src ReadSeekCloser) (*Player, error) { func NewPlayer(context *Context, src ReadSeekCloser) (*Player, error) {
if context.players.hasSource(src) { if context.players.hasSource(src) {
return nil, errors.New("audio: src cannot be shared with another Player") return nil, errors.New("audio: src cannot be shared with another Player")
@ -356,8 +352,6 @@ func NewPlayer(context *Context, src ReadSeekCloser) (*Player, error) {
// The format of src should be same as noted at NewPlayer. // The format of src should be same as noted at NewPlayer.
// //
// NewPlayerFromBytes returns error in the same situation of NewPlayer. // NewPlayerFromBytes returns error in the same situation of NewPlayer.
//
// This function is concurrent-safe.
func NewPlayerFromBytes(context *Context, src []byte) (*Player, error) { func NewPlayerFromBytes(context *Context, src []byte) (*Player, error) {
b := BytesReadSeekCloser(src) b := BytesReadSeekCloser(src)
return NewPlayer(context, b) return NewPlayer(context, b)
@ -368,8 +362,6 @@ func NewPlayerFromBytes(context *Context, src []byte) (*Player, error) {
// When closing, the stream owned by the player will also be closed by calling its Close. // When closing, the stream owned by the player will also be closed by calling its Close.
// //
// Close returns error when closing the source returns error. // Close returns error when closing the source returns error.
//
// This function is concurrent-safe.
func (p *Player) Close() error { func (p *Player) Close() error {
p.players.removePlayer(p) p.players.removePlayer(p)
runtime.SetFinalizer(p, nil) runtime.SetFinalizer(p, nil)
@ -406,16 +398,12 @@ func (p *Player) bufferLength() int {
// Play plays the stream. // Play plays the stream.
// //
// Play always returns nil. // Play always returns nil.
//
// This function is concurrent-safe.
func (p *Player) Play() error { func (p *Player) Play() error {
p.players.addPlayer(p) p.players.addPlayer(p)
return nil return nil
} }
// IsPlaying returns boolean indicating whether the player is playing. // IsPlaying returns boolean indicating whether the player is playing.
//
// This function is concurrent-safe.
func (p *Player) IsPlaying() bool { func (p *Player) IsPlaying() bool {
return p.players.hasPlayer(p) return p.players.hasPlayer(p)
} }
@ -423,8 +411,6 @@ func (p *Player) IsPlaying() bool {
// Rewind rewinds the current position to the start. // Rewind rewinds the current position to the start.
// //
// Rewind returns error when seeking the source returns error. // Rewind returns error when seeking the source returns error.
//
// This function is concurrent-safe.
func (p *Player) Rewind() error { func (p *Player) Rewind() error {
return p.Seek(0) return p.Seek(0)
} }
@ -432,8 +418,6 @@ func (p *Player) Rewind() error {
// Seek seeks the position with the given offset. // Seek seeks the position with the given offset.
// //
// Seek returns error when seeking the source returns error. // Seek returns error when seeking the source returns error.
//
// This function is concurrent-safe.
func (p *Player) Seek(offset time.Duration) error { func (p *Player) Seek(offset time.Duration) error {
p.players.addSeeking(p) p.players.addSeeking(p)
defer p.players.removeSeeking(p) defer p.players.removeSeeking(p)
@ -451,16 +435,12 @@ func (p *Player) Seek(offset time.Duration) error {
// Pause pauses the playing. // Pause pauses the playing.
// //
// Pause always returns nil. // Pause always returns nil.
//
// This function is concurrent-safe.
func (p *Player) Pause() error { func (p *Player) Pause() error {
p.players.removePlayer(p) p.players.removePlayer(p)
return nil return nil
} }
// Current returns the current position. // Current returns the current position.
//
// This function is concurrent-safe.
func (p *Player) Current() time.Duration { func (p *Player) Current() time.Duration {
sample := p.pos / bytesPerSample / channelNum sample := p.pos / bytesPerSample / channelNum
return time.Duration(sample) * time.Second / time.Duration(p.sampleRate) return time.Duration(sample) * time.Second / time.Duration(p.sampleRate)

View File

@ -139,8 +139,6 @@ type Image struct {
} }
// Size returns the size of the image. // Size returns the size of the image.
//
// This function is concurrent-safe.
func (i *Image) Size() (width, height int) { func (i *Image) Size() (width, height int) {
return i.impl.restorable.Size() return i.impl.restorable.Size()
} }
@ -150,8 +148,6 @@ func (i *Image) Size() (width, height int) {
// When the image is disposed, Clear does nothing. // When the image is disposed, Clear does nothing.
// //
// Clear always returns nil as of 1.5.0-alpha. // Clear always returns nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func (i *Image) Clear() error { func (i *Image) Clear() error {
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext()) theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
i.impl.Fill(color.Transparent) i.impl.Fill(color.Transparent)
@ -163,8 +159,6 @@ func (i *Image) Clear() error {
// When the image is disposed, Fill does nothing. // When the image is disposed, Fill does nothing.
// //
// Fill always returns nil as of 1.5.0-alpha. // Fill always returns nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func (i *Image) Fill(clr color.Color) error { func (i *Image) Fill(clr color.Color) error {
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext()) theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
i.impl.Fill(clr) i.impl.Fill(clr)
@ -193,8 +187,6 @@ func (i *Image) Fill(clr color.Color) error {
// When image is as same as i, DrawImage panics. // When image is as same as i, DrawImage panics.
// //
// DrawImage always returns nil as of 1.5.0-alpha. // DrawImage always returns nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func (i *Image) DrawImage(image *Image, options *DrawImageOptions) error { func (i *Image) DrawImage(image *Image, options *DrawImageOptions) error {
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext()) theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
i.impl.DrawImage(image, options) i.impl.DrawImage(image, options)
@ -202,16 +194,12 @@ func (i *Image) DrawImage(image *Image, options *DrawImageOptions) error {
} }
// Bounds returns the bounds of the image. // Bounds returns the bounds of the image.
//
// This function is concurrent-safe.
func (i *Image) Bounds() image.Rectangle { func (i *Image) Bounds() image.Rectangle {
w, h := i.impl.restorable.Size() w, h := i.impl.restorable.Size()
return image.Rect(0, 0, w, h) return image.Rect(0, 0, w, h)
} }
// ColorModel returns the color model of the image. // ColorModel returns the color model of the image.
//
// This function is concurrent-safe.
func (i *Image) ColorModel() color.Model { func (i *Image) ColorModel() color.Model {
return color.RGBAModel return color.RGBAModel
} }
@ -221,8 +209,6 @@ func (i *Image) ColorModel() color.Model {
// This method loads pixels from VRAM to system memory if necessary. // This method loads pixels from VRAM to system memory if necessary.
// //
// This method can't be called before the main loop (ebiten.Run) starts (as of version 1.4.0-alpha). // This method can't be called before the main loop (ebiten.Run) starts (as of version 1.4.0-alpha).
//
// This function is concurrent-safe.
func (i *Image) At(x, y int) color.Color { func (i *Image) At(x, y int) color.Color {
return i.impl.At(x, y, glContext()) return i.impl.At(x, y, glContext())
} }
@ -235,8 +221,6 @@ func (i *Image) At(x, y int) color.Color {
// When the image is disposed, Dipose does nothing. // When the image is disposed, Dipose does nothing.
// //
// Dipose always return nil as of 1.5.0-alpha. // Dipose always return nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func (i *Image) Dispose() error { func (i *Image) Dispose() error {
if i.impl.isDisposed() { if i.impl.isDisposed() {
return nil return nil
@ -257,8 +241,6 @@ func (i *Image) Dispose() error {
// When the image is disposed, ReplacePixels does nothing. // When the image is disposed, ReplacePixels does nothing.
// //
// ReplacePixels always returns nil as of 1.5.0-alpha. // ReplacePixels always returns nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func (i *Image) ReplacePixels(p []uint8) error { func (i *Image) ReplacePixels(p []uint8) error {
theImagesForRestoring.resetPixelsIfDependingOn(i, glContext()) theImagesForRestoring.resetPixelsIfDependingOn(i, glContext())
i.impl.ReplacePixels(p) i.impl.ReplacePixels(p)
@ -281,8 +263,6 @@ type DrawImageOptions struct {
// If width or height is less than 1 or more than MaxImageSize, NewImage panics. // If width or height is less than 1 or more than MaxImageSize, NewImage panics.
// //
// Error returned by NewImage is always nil as of 1.5.0-alpha. // Error returned by NewImage is always nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func NewImage(width, height int, filter Filter) (*Image, error) { func NewImage(width, height int, filter Filter) (*Image, error) {
checkSize(width, height) checkSize(width, height)
img := newImageImpl(width, height, filter, false) img := newImageImpl(width, height, filter, false)
@ -303,8 +283,6 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
// If width or height is less than 1 or more than MaxImageSize, newVolatileImage panics. // If width or height is less than 1 or more than MaxImageSize, newVolatileImage panics.
// //
// Error returned by newVolatileImage is always nil as of 1.5.0-alpha. // Error returned by newVolatileImage is always nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func newVolatileImage(width, height int, filter Filter) (*Image, error) { func newVolatileImage(width, height int, filter Filter) (*Image, error) {
checkSize(width, height) checkSize(width, height)
img := newImageImpl(width, height, filter, true) img := newImageImpl(width, height, filter, true)
@ -317,8 +295,6 @@ func newVolatileImage(width, height int, filter Filter) (*Image, error) {
// If source's width or height is less than 1 or more than MaxImageSize, NewImageFromImage panics. // If source's width or height is less than 1 or more than MaxImageSize, NewImageFromImage panics.
// //
// Error returned by NewImageFromImage is always nil as of 1.5.0-alpha. // Error returned by NewImageFromImage is always nil as of 1.5.0-alpha.
//
// This function is concurrent-safe.
func NewImageFromImage(source image.Image, filter Filter) (*Image, error) { func NewImageFromImage(source image.Image, filter Filter) (*Image, error) {
size := source.Bounds().Size() size := source.Bounds().Size()
checkSize(size.X, size.Y) checkSize(size.X, size.Y)