-
-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Opps, forgot to add files into the commit
- Loading branch information
1 parent
18e998d
commit 0016360
Showing
3 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "stdafx.h" | ||
#include "ScopeLock.hpp" | ||
#include "Threading/Lock.hpp" | ||
#include "xrDebug.h" | ||
|
||
ScopeLock::ScopeLock(Lock* SyncObject) : syncObject(SyncObject) | ||
{ | ||
R_ASSERT(syncObject); | ||
syncObject->Enter(); | ||
} | ||
|
||
ScopeLock::~ScopeLock() | ||
{ | ||
syncObject->Leave(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include "Common/Noncopyable.hpp" | ||
|
||
class XRCORE_API ScopeLock : Noncopyable | ||
{ | ||
Lock* syncObject; | ||
|
||
public: | ||
ScopeLock(Lock* SyncObject); | ||
~ScopeLock(); | ||
}; |
0016360
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.
@Xottab-DUTY, Why did you extract implementation into separate compile object and export such simple object? In my mind it's unnecessary overhead, especially for the sync object
0016360
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.
@NeoAnomaly
0016360
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.
@NeoAnomaly lock objects are often included and it is crucial for its headers to be as slim as possible. @Xottab-DUTY does things the right way.
0016360
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.
Yes it's simple but, as @andrew-boyarshin said, this was done to make it lightweight, make it even simplier.