Other Issues

Other resources
Mutex
Mutex or Channel
How to know TCP connection is closed?
Some example on mutex and runtime.Gosched 

 simpler chat server and client in golang
Golang Away: TCP Chat Server
  TCP Echo Server in Golang

 package main

import (
    "fmt"
    "runtime"
    "sync"
)

func main() {
    Default()
    A()
    B()
    C()
}

func Default() {
    go somefunc()
    fmt.Println("Default")
}

func A() {
    go somefunc()
    runtime.Gosched()
    fmt.Println("A")
}

func B() {
    ch := make(chan struct{})
    go func() {
        close(ch)
        somefunc()
    }()
    <-ch
    fmt.Println("B")
}

func C() {
    mu := &sync.Mutex{}
    mu.Lock()
    go func() {
        mu.Unlock()
        somefunc()
    }()
    mu.Lock()
    fmt.Println("C")
}

func somefunc() {
    fmt.Println("somefunc")
}







Golang pointers


GoLang: init function for Structs

Idiom for modifying value of a list element? https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/JG5TMxj_u74
http://play.golang.org/p/lYB6ZeXLuX


golang pointers on pointers as function parameters


Memory, variables in memory, and pointers http://golangtutorials.blogspot.com/2011/06/memory-variables-in-memory-and-pointers.html








Comments