Thanks a lot, I also want to know what the first lock meaning is?
在 2018年3月13日星期二 UTC+8下午9:32:35,Burak Serdar写道:
>
> The second lock waits until f() runs and unlocks the mutex.
>
> On Tue, Mar 13, 2018 at 3:37 AM, 郎凯
> wrote:
> > var l sync.Mutex
> > var a string
> >
>
The second lock waits until f() runs and unlocks the mutex.
On Tue, Mar 13, 2018 at 3:37 AM, 郎凯 wrote:
> var l sync.Mutex
> var a string
>
> func f() {
> a = "hello, world"
> l.Unlock()
> }
>
> func main() {
> l.Lock()
> go f()
> l.Lock()
> print(a)
> }
>
> I'm a new