concurrent

package
v5.1.15+incompatible Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2019 Huawei Technologies Co.,Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2019 Huawei Technologies Co.,Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2019 Huawei Technologies Co.,Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrPoolShutDown = errors.New("RoutinePool is shutdown")
View Source
var ErrSubmitTimeout = errors.New("Submit task timeout")
View Source
var ErrTaskInvalid = errors.New("Task is nil")
View Source
var ErrTaskReject = errors.New("Submit task is rejected")

Functions

This section is empty.

Types

type Future

type Future interface {
	Get() interface{}
}

type FutureResult

type FutureResult struct {
	// contains filtered or unexported fields
}

func (*FutureResult) Get

func (f *FutureResult) Get() interface{}

type NoChanPool

type NoChanPool struct {
	// contains filtered or unexported fields
}

func (*NoChanPool) AddCurrentWorkingCnt

func (pool *NoChanPool) AddCurrentWorkingCnt(value int64) int64

func (*NoChanPool) AddMaxWorkerCnt

func (pool *NoChanPool) AddMaxWorkerCnt(value int64) int64

func (*NoChanPool) AddWorkerCnt

func (pool *NoChanPool) AddWorkerCnt(value int64) int64

func (*NoChanPool) CompareAndSwapCurrentWorkingCnt

func (pool *NoChanPool) CompareAndSwapCurrentWorkingCnt(oldValue, newValue int64) bool

func (*NoChanPool) EnableAutoTune

func (pool *NoChanPool) EnableAutoTune()

func (*NoChanPool) Execute

func (pool *NoChanPool) Execute(t Task)

func (*NoChanPool) ExecuteFunc

func (pool *NoChanPool) ExecuteFunc(f func() interface{})

func (*NoChanPool) GetCurrentWorkingCnt

func (pool *NoChanPool) GetCurrentWorkingCnt() int64

func (*NoChanPool) GetMaxWorkerCnt

func (pool *NoChanPool) GetMaxWorkerCnt() int64

func (*NoChanPool) GetWorkerCnt

func (pool *NoChanPool) GetWorkerCnt() int64

func (*NoChanPool) ShutDown

func (pool *NoChanPool) ShutDown()

func (*NoChanPool) Submit

func (pool *NoChanPool) Submit(t Task) (Future, error)

func (*NoChanPool) SubmitFunc

func (pool *NoChanPool) SubmitFunc(f func() interface{}) (Future, error)

type Pool

type Pool interface {
	ShutDown()
	Submit(t Task) (Future, error)
	SubmitFunc(f func() interface{}) (Future, error)
	Execute(t Task)
	ExecuteFunc(f func() interface{})
	GetMaxWorkerCnt() int64
	AddMaxWorkerCnt(value int64) int64
	GetCurrentWorkingCnt() int64
	AddCurrentWorkingCnt(value int64) int64
	GetWorkerCnt() int64
	AddWorkerCnt(value int64) int64
	EnableAutoTune()
}

func NewNochanPool

func NewNochanPool(maxWorkerCnt int) Pool

func NewRoutinePool

func NewRoutinePool(maxWorkerCnt, cacheCnt int) Pool

type RoutinePool

type RoutinePool struct {
	// contains filtered or unexported fields
}

func (*RoutinePool) AddCurrentWorkingCnt

func (pool *RoutinePool) AddCurrentWorkingCnt(value int64) int64

func (*RoutinePool) AddMaxWorkerCnt

func (pool *RoutinePool) AddMaxWorkerCnt(value int64) int64

func (*RoutinePool) AddWorkerCnt

func (pool *RoutinePool) AddWorkerCnt(value int64) int64

func (*RoutinePool) CompareAndSwapCurrentWorkingCnt

func (pool *RoutinePool) CompareAndSwapCurrentWorkingCnt(oldValue, newValue int64) bool

func (*RoutinePool) EnableAutoTune

func (pool *RoutinePool) EnableAutoTune()

func (*RoutinePool) Execute

func (pool *RoutinePool) Execute(t Task)

func (*RoutinePool) ExecuteFunc

func (pool *RoutinePool) ExecuteFunc(f func() interface{})

func (*RoutinePool) GetCurrentWorkingCnt

func (pool *RoutinePool) GetCurrentWorkingCnt() int64

func (*RoutinePool) GetMaxWorkerCnt

func (pool *RoutinePool) GetMaxWorkerCnt() int64

func (*RoutinePool) GetWorkerCnt

func (pool *RoutinePool) GetWorkerCnt() int64

func (*RoutinePool) ShutDown

func (pool *RoutinePool) ShutDown()

func (*RoutinePool) Submit

func (pool *RoutinePool) Submit(t Task) (Future, error)

func (*RoutinePool) SubmitFunc

func (pool *RoutinePool) SubmitFunc(f func() interface{}) (Future, error)

func (*RoutinePool) SubmitWithTimeout

func (pool *RoutinePool) SubmitWithTimeout(t Task, timeout int64) (Future, error)

type Task

type Task interface {
	Run() interface{}
}

Jump to

Keyboard shortcuts

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