func close_safe(c chan bool) {
select {
case <-c:
default:
close(c)
}
}
Closing a channel onece more can be a controversial topic, sometimes it is
useuful.
I saw the code to close a closed channel. I thought the code looked nice at
first, but could become errernous.
Let's assume that two goruti
2016년 12월 16일 금요일 오전 11시 5분 53초 UTC+9, Peng Wang 님의 말:
>
> Actually I don't really care about that, just don't want break the
> interface requirement
> in the doc it says "WriteAt writes len(p) bytes from p to the underlying
> data stream at offset off. It returns the number of bytes written from
2016년 12월 16일 금요일 오전 11시 5분 53초 UTC+9, Peng Wang 님의 말:
Actually I don't really care about that, just don't want break the
interface requirement
in the doc it says "WriteAt writes len(p) bytes from p to the underlying
data stream at offset off. It returns the number of bytes written from p (0
<=
runtime.GOMAXPROCS(n) behaves in two ways: getter if n < 1, otherwise
setter.
For setter, does runtime.SetGOMAXPROCS(n) look good? The only reason behind
current behavior is the function is rarely used?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts
I measured how long it takes to access an element on array in three ways:
array, slice, unsafe.Pointer
https://play.golang.org/p/Ofz3u8_AZe
BenchmarkArray : 500025.7 ns/op
BenchmarkSlice : 200059.1 ns/op
BenchmarkPointer: 3 6.85 ns/op
BenchmarkC : 2
Using inherent print function, you can see this more
clearly: https://play.golang.org/p/WKk7n9U2zt
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+un
https://play.golang.org/p/4XZSmyRkZa
I've got error message when building the code as follows:
C:\Users\Home\AppData\Local\Temp\go-build437760086\command-line-arguments\_obj\_cgo_main.o:_cgo_main.c:(.data+0x0):
undefined reference to `stdout'
collect2.exe: error: ld returned 1 exit status
I do