-
Notifications
You must be signed in to change notification settings - Fork 863
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
Added CSync class as high level CV wrapper #1067
Conversation
and m_PassCond to m_BufferLock and m_BufferCond
The only place affected is the garbage collector thread. On Linux it used to wait for 10 us, on Windows - 1 millisecond. Now 1 millisecond on both platforms.
srtcore/sync.cpp
Outdated
// We expect m_nolock == true. | ||
lock_signal(*m_cond, *m_mutex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_nolock
is something that will be added in the future? Or in the debug logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. The comment remained after I purged this from the thread logging implementation stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good reason CSync class is not wrapping pthread_cond_init() as well? I think that would help with the move to monotonic clock functions.
No. This is not its purpose. The purpose of this class is to serve as a local variable wrapping "temporarily" a condition variable and mutex, usually through CGuard (UniqueLock in future). Max will provide another class, together with new thread libraries (#800) that will allow to combine mutex and cv, this time usable as a field that replace separate fields of mutex and cv. However, this solution will not be applicable in every place - only where the use of mutex+cv is simple. This will also replace the use of current |
Added
CSync
class. This is predicted to be used exclusively in the local context. It should wrap a conditional variable and the associated mutex in order to perform an operation on them together.The use of
CSync
class replaces every case of usingpthread_cond_*
functions directly (small exception is in the timer code).