etcd/pkg/testutil/testutil.go

31 lines
868 B
Go
Raw Normal View History

/*
Copyright 2014 CoreOS, Inc.
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.
*/
2014-10-27 19:46:37 +03:00
package testutil
2014-09-20 01:32:38 +04:00
import (
"runtime"
)
// WARNING: This is a hack.
// Remove this when we are able to block/check the status of the go-routines.
func ForceGosched() {
// possibility enough to sched up to 10 go routines.
2014-09-20 01:32:38 +04:00
for i := 0; i < 10000; i++ {
runtime.Gosched()
}
}