We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
源码和注释:
const sharedQueue: SharedQueue<State> = (updateQueue: any).shared; const pending = sharedQueue.pending; if (pending === null) { // 若链表中没有元素,则创建单向环状链表,next指向它自己 update.next = update; } else { // 有元素,现有队列(pending)指向的是链表的尾部update, // pending.next就是头部update,新update会放到现有队列的最后并首尾相连 // 将新队列的尾部(新插入的update)的next指向队列的首部,实现首位相连 update.next = pending.next; // 现有队列的最后一个元素的next指向新来的update,实现把新update接到现有队列上 pending.next = update; } // 现有队列的指针总是指向最后一个update,可以通过最后一个寻找出整条链表 sharedQueue.pending = update;
The text was updated successfully, but these errors were encountered:
抱歉,我重新看了一下,你的画法是把 update 1 作为头节点,我下意识地以为最右边的 update 2 才是头节点。如果能在 update 1 下面标出是头节点的话就不会产生误解了。
Sorry, something went wrong.
No branches or pull requests
源码和注释:
The text was updated successfully, but these errors were encountered: