This simple design, possible because the data obeys strict LIFO order, means that no complex data structure is needed to track stack contents - a simple pointer to the top of the stack will do.
这种简单的设计,很有可能是考虑到数据操作都符合后进先出(LIFO )规则,这意味着访问栈的内容并不需要复杂的数据结构,一个简单的栈顶指针就能搞定一切。
So, the code loops back, points to the proper top pointer (which was changed because of Thread b), invokes CAS, and is done with pushing 20 into the stack.
因此,代码回到循环的开头,指向正确的top指针(线程b修改后的),调用CAS,把20压入堆栈后结束。
If a function is executing, then the stack pointer is pointing to the top of the whole stack, which is also the top of that function's activation record.
如果一个函数正在执行,那么堆栈指针就会指向整个堆栈的顶部,这也是该函数活动记录的顶部。
As we click around in the application, new events will be pushed onto the top of the stack, and the pointer will identify the last element added.
当我们在应用程序中单击的时候,新的事件将被压入堆栈顶部,指针指向最后添加的元素。
From the standpoint of a single thread, a new node is created whose next pointer points to the top of the stack.
从单一线程的角度来看,创建了一个新节点,它的next指针指向堆栈的顶部。
This simple design, possible because the data obeys strict LIFO order, means that no complex data structure is needed to track stack contents – a simple pointer to the top of the stack will do.
这个简单的设计,可能是因为数据遵循严格的后进先出顺序,这意味着没有复杂的数据结构需要跟踪堆栈的内容-一个简单的指针的堆栈的顶部就可以了。
This simple design, possible because the data obeys strict LIFO order, means that no complex data structure is needed to track stack contents – a simple pointer to the top of the stack will do.
这个简单的设计,可能是因为数据遵循严格的后进先出顺序,这意味着没有复杂的数据结构需要跟踪堆栈的内容-一个简单的指针的堆栈的顶部就可以了。
应用推荐