Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Light-City committed Jul 6, 2020
1 parent bb46ce8 commit 5354c10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions design_pattern/singleton/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ p = new singleton;
- 线程A调用instance,执行第一次p的测试,获得锁,按照1,3,执行,然后被挂起。此时p是非空的,但是p指向的内存中还没有Singleton对象被构造。
- 线程B调用instance,判定p非空, 将其返回给instance的调用者。调用者对指针解引用以获得singleton,噢,一个还没有被构造出的对象。bug就出现了。

DCLP能够良好的工作仅当步骤一和二在步骤三之前被执行,但是并没有并没有方法在C或C++中表达这种限制。这就像是插在DCLP心脏上的一把匕首:我们需要在相对指令顺序上定义限制,但是我们的语言没有给出表达这种限制的方法。
DCLP能够良好的工作仅当步骤一和二在步骤三之前被执行,但是并没有方法在C或C++中表达这种限制。这就像是插在DCLP心脏上的一把匕首:我们需要在相对指令顺序上定义限制,但是我们的语言没有给出表达这种限制的方法。

## 5.memory barrier指令

Expand Down Expand Up @@ -324,4 +324,4 @@ public:

> https://www.cnblogs.com/liyuan989/p/4264889.html

> https://segmentfault.com/a/1190000015950693
> https://segmentfault.com/a/1190000015950693

0 comments on commit 5354c10

Please sign in to comment.