Skip to content

refactor: ⚡ refactor the AP of Bullet - #556

Merged
shangfengh merged 4 commits into
eesast:devfrom
shangfengh:new
May 19, 2023
Merged

refactor: ⚡ refactor the AP of Bullet#556
shangfengh merged 4 commits into
eesast:devfrom
shangfengh:new

Conversation

@shangfengh

Copy link
Copy Markdown
Member

Descriptions of this pull request:

No additional discription.

@shangfengh
shangfengh merged commit 94bb876 into eesast:dev May 19, 2023
protected int ap;
public int AP
{
get => Interlocked.CompareExchange(ref ap, 0, 1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
get => Interlocked.CompareExchange(ref ap, 0, 1);
get => Interlocked.CompareExchange(ref ap, 0, 0);

@Timothy-Liuxf Timothy-Liuxf May 19, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CompareExchange(ref a, b, c) 的含义是 if (a == c) a = b;,所以在读取的时候应该保证 b == c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants