chai2010
Go语言高级编程

Updated 21 days ago

fengbianyun (@fengbianyun) started discussion #10

2 months ago · 0 comments

Open

但是Go语言并不保证在main函数中观测到的对done的写入操作发生在对字符串a的写入的操作之后,因此程序很可能打印一个空字符串。更糟糕的是,因为两个线程之间没有同步事件,setup线程对done的写入操作甚至无法被main线程看到,main函数有可能陷入死循环中。

1.5 面向并发的内存模型 (Edit this file)

按照我粗浅的理解,a="hello wrold"执行完毕之后才会执行“done=true”指令,难道将一个字符串常量赋值操作不是同步的?还是说在main线程里面看到的setup中所有指令都是混乱的?

No description provided.

No comments on this discussion.


to join this conversation on GitBook. Already have an account? Sign in to comment
Notifications

You’re not receiving notifications from this thread.


1 participant