// RegisterStackDumper spawns a goroutine which dumps stack trace upon a SIGUSR1
166415
func RegisterStackDumper() {
	go func() {
		sigs := make(chan os.Signal, 1)
		signal.Notify(sigs, syscall.SIGUSR1)
		for {
			<-sigs
			LogStack()
		}
	}()
}
1262393
func (m *Mux) SetStack(stack []plugin.Plugin) {
	m.Middleware.SetStack(stack)
}
555710
func ListStacks(session *session.Session,
	maxReturned int,
	stackFilters ...string) ([]*cloudformation.StackSummary, error) {

	listStackInput := &cloudformation.ListStacksInput{
		StackStatusFilter: []*string{},
	}
	for _, eachFilter := range stackFilters {
		listStackInput.StackStatusFilter = append(listStackInput.StackStatusFilter, aws.String(eachFilter))
	}
	cloudformationSvc := cloudformation.New(session)
	accumulator := []*cloudformation.StackSummary{}
	for {
		listResult, listResultErr := cloudformationSvc.ListStacks(listStackInput)
		if listResultErr != nil {
			return nil, listResultErr
		}
		accumulator = append(accumulator, listResult.StackSummaries...)
		if len(accumulator) >= maxReturned || listResult.NextToken == nil {
			return accumulator, nil
		}
		listStackInput.NextToken = listResult.NextToken
	}
}
1155377
func NewStack(size int) *Stack {
	if size < 0 {
		panic(IllegalArgumentError{"size must >= 0"})
	}
	stack := &Stack{}
	stack.values = list.New()
	return stack
}
227685
func CaptureStacktrace(th *starlark.Thread, skip int) (*CapturedStacktrace, error) {
	f := th.Caller()
	skipped := 0
	for skipped < skip && f != nil {
		f = f.Parent()
		skipped++
	}
	if f == nil {
		return nil, fmt.Errorf("stacktrace: the stack is not deep enough to skip %d levels, has only %d frames", skip, skipped)
	}
	buf := strings.Builder{}
	f.WriteBacktrace(&buf)
	return &CapturedStacktrace{buf.String()}, nil
}
278085
func (d *Context) RequireStack(extra int) {
	C.duk_require_stack(d.duk_context, C.duk_idx_t(extra))
}
38952
func RegisterHeapDumper(filePath string) {
	go func() {
		sigs := make(chan os.Signal, 1)
		signal.Notify(sigs, syscall.SIGUSR2)
		for {
			<-sigs
			runtime.GC()
			if _, err := os.Stat(filePath); err == nil {
				err = os.Remove(filePath)
				if err != nil {
					log.Warnf("could not delete heap profile file: %v", err)
					return
				}
			}
			f, err := os.Create(filePath)
			if err != nil {
				log.Warnf("could not create heap profile file: %v", err)
				return
			}

			if err := pprof.WriteHeapProfile(f); err != nil {
				log.Warnf("could not write heap profile: %v", err)
				return
			} else {
				log.Infof("dumped heap profile to %s", filePath)
			}
		}
	}()
}
984267
func (c *Conn) loadCertificateStack(sk *C.struct_stack_st_X509) (
	rv []*Certificate) {

	sk_num := int(C.X_sk_X509_num(sk))
	rv = make([]*Certificate, 0, sk_num)
	for i := 0; i < sk_num; i++ {
		x := C.X_sk_X509_value(sk, C.int(i))
		// ref holds on to the underlying connection memory so we don't need to
		// worry about incrementing refcounts manually or freeing the X509
		rv = append(rv, &Certificate{x: x, ref: c})
	}
	return rv
}
732194
func getStackTracer(err error) (stackTracer, bool) {
	var st stackTracer

	ForEachCause(err, func(err error) bool {
		if s, ok := err.(stackTracer); ok {
			st = s

			return false
		}

		return true
	})

	return st, st != nil
}
762657
func BuildStackWithCallers(callers []uintptr) Stack {
	stack := make(Stack, 0, len(callers))

	for _, caller := range callers {
		if fn := runtime.FuncForPC(caller); fn != nil {
			file, line := fn.FileLine(caller)
			stack = append(stack, Frame{shortenFilePath(file), functionNameFromFunc(fn), line})
		}
	}

	return stack
}
1020580
func (c *SQLiteConn) RegisterRollbackHook(callback func()) {
	if callback == nil {
		C.sqlite3_rollback_hook(c.db, nil, nil)
	} else {
		C.sqlite3_rollback_hook(c.db, (*[0]byte)(C.rollbackHookTrampoline), unsafe.Pointer(newHandle(c, callback)))
	}
}
1362307
func RegisterBulkCallback(bcb BulkCallback) {
	id := atomic.AddUint32(curBulkCbID, 1) - 1

	if id >= maxNumCallbacks {
		panic("Too many callbacks")
	}

	bulkCBs[id] = bcb
}
1167939
func CreateStack(createRequest StackCreateRequest) (Stack, error) {
	url := "stack/"
	request := "POST"
	var response Stack

	newStack, err := json.Marshal(createRequest)
	if err != nil {
		return response, err
	}

	log.Println(string(newStack))

	data, err := TutumCall(url, request, newStack)
	if err != nil {
		return response, err
	}

	err = json.Unmarshal(data, &response)
	if err != nil {
		return response, err
	}

	return response, nil
}
590349
func (s *Service) RegisterSDK(r *Registry) {
	if s.ServeMux == nil {
		s.ServeMux = http.NewServeMux()
	}

	s.sdk[r.Path] = r
	s.ServeMux.HandleFunc(r.Path, s.ServeSDK)
}
212013
func RegisterFlowCombinationHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
	return RegisterFlowCombinationHandlerClient(ctx, mux, NewFlowCombinationClient(conn))
}
413096
func MarshalStack(err error) interface{} {
	type stackTracer interface {
		StackTrace() errors.StackTrace
	}
	sterr, ok := err.(stackTracer)
	if !ok {
		return nil
	}
	st := sterr.StackTrace()
	s := &state{}
	out := make([]map[string]string, 0, len(st))
	for _, frame := range st {
		out = append(out, map[string]string{
			StackSourceFileName:     frameField(frame, s, 's'),
			StackSourceLineName:     frameField(frame, s, 'd'),
			StackSourceFunctionName: frameField(frame, s, 'n'),
		})
	}
	return out
}
841798
func (cp *CallbackProcessor) Register(callbackName string, callback func(scope *Scope)) {
	if cp.kind == "row_query" {
		if cp.before == "" && cp.after == "" && callbackName != "gorm:row_query" {
			log.Printf("Registing RowQuery callback %v without specify order with Before(), After(), applying Before('gorm:row_query') by default for compatibility...\n", callbackName)
			cp.before = "gorm:row_query"
		}
	}

	cp.name = callbackName
	cp.processor = &callback
	cp.parent.processors = append(cp.parent.processors, cp)
	cp.parent.reorder()
}