Skip to content
New issue

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

Remove the lock for IsConnectionAlive get method #6

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

limaolm
Copy link

@limaolm limaolm commented Aug 26, 2018

Hi Woong,

Thanks for create and open source EpServerEngine.cs. It's a great project. However, I found the performance can be greatly improved in some case by a minor change. The get method of IsConnectionAlive property does not need to be guarded by m_generalLock lock. It's bool type. If a caller client need to query IsConnectionAlive in a loop, the unnecessary lock might introduce race condition/wait with other operations.

public bool IsConnectionAlive
{
get
{
lock (m_generalLock)
{
return m_isConnected;
}
}
private set
{
lock (m_generalLock)
{
m_isConnected = value;
}
}

limaolm and others added 3 commits August 26, 2018 19:36
change to use http for submodule
update to EpLibrary.cs
@limaolm limaolm changed the title Remove the lock for IsConnectionAlive set method Remove the lock for IsConnectionAlive get method Aug 26, 2018
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.

1 participant