=0{lock(&sched.lock)gp := globrunqget(_p_,0)unlock(&sched.lock)ifgp !=nil{returngp,false,false}}...// Spinning Ms: steal work from other Ps./// Limit the number of spinning Ms to half the number of busy Ps.// This is necessary to prevent...
//第一部分,前置检查 //参数为slice类型,原silce,目的扩容大小 func growslice(et *_type, old slice, cap int) slice { //竞态检查 if raceenabled { callerpc := getcallerpc() racereadrangepc(old.array, uintptr(old.len*int(et.size)), callerpc, funcPC(growslice)) } if msanenabled { ms...
// Note: if the slice panics here, it is probably because // the underlying reader returned a bad count. See issue 49795. n =copy(p, b.buf[b.r:b.w]) b.r += n b.lastByte =int(b.buf[b.r-1]) b.lastRuneSize =-1 returnn,nil } // 按行读取内容 func(b *Reader)ReadLine...
// Allocate the current slice and remember pointers to both current and old. // This preserves all relevant overflow buckets alive even if // the table grows and/or overflow buckets are added to the table // while we are iterating. h.createOverflow() it.overflow = h.extra.overflow it....
Go分为数据类型分为值类型和引用类型,其中值类型是 int、float、string、bool、struct和array,它们直接存储值,分配栈的内存空间,它们被函数调用完之后会释放;引用类型是 slice、map、chan和值类型对应的指针 它们存储是一个地址(或者理解为指针),指针指向内存中真正存储数据的首地址,内存通常在堆分配,通过GC回收。
// // We used to check whether doing one time slice of work // would remain under the utilization goal, but that has the // effect of delaying work until the mutator has run for // enough time slices to pay for the work. During those time // slices, write barriers are enabled, ...
// If RootCAs is nil, TLS uses the host's root CA set. RootCAs *x509.CertPool // ServerName is used to verify the hostname on the returned // certificates unless InsecureSkipVerify is given. It is also included // in the client's handshake to support virtual hosting unless it is ...
fix logger Args is empty slice 7年前 mapper.go support postgres sql quotes,fix #15 6年前 mapper_test.go Upgrade the major version to V2 6年前 model.go Update model.go 5年前 model_test.go support postgres sql quotes,fix #15 6年前 ...
StringList allows to collect multiple string values into the slice of strings by repeating same flag multiple times. Such as$ progname --string hostname1 --string hostname2 -s hostname3 varmyStringList*[]string=parser.StringList("s","string",...) ...
// empty报告从c读取是否会阻塞(即通道为空)。它使用可变状态的单个原子读取。 func empty(c *hchan) bool { // c.dataqsiz is immutable. // c.dataqsiz是不可变的。 if c.dataqsiz == 0 { return atomic.Loadp(unsafe.Pointer(&c.sendq.first)) == nil } return atomic.Loaduint(&c.qcount)...