Skip to content

Commit

Permalink
Opps, forgot to add files into the commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Mar 25, 2018
1 parent 18e998d commit 0016360
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
15 changes: 15 additions & 0 deletions src/xrCore/Threading/ScopeLock.cpp
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();
}
27 changes: 0 additions & 27 deletions src/xrCore/Threading/ScopeLock.h

This file was deleted.

12 changes: 12 additions & 0 deletions src/xrCore/Threading/ScopeLock.hpp
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();
};

4 comments on commit 0016360

@NeoAnomaly
Copy link
Contributor

@NeoAnomaly NeoAnomaly commented on 0016360 Mar 25, 2018

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

@andrew-boyarshin
Copy link
Contributor

Choose a reason for hiding this comment

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

@NeoAnomaly

  1. Reduce header dependencies, they are more lightweight this way
  2. Code Quality matters.

@andrew-boyarshin
Copy link
Contributor

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.

@Xottab-DUTY
Copy link
Member Author

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.

Please sign in to comment.