Skip to content

Commit

Permalink
Move CThread and CThreadManager to new xrUtil library.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Sep 25, 2015
1 parent 98aef2a commit 7a05d41
Show file tree
Hide file tree
Showing 41 changed files with 1,090 additions and 366 deletions.
671 changes: 670 additions & 1 deletion src/engine.sln

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/utils/xrAI/compiler_cover.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "compiler.h"
#include "xrCDB/Intersect.hpp"
#include "xrThread.h"
#include "utils/xrUtil/xrThread.hpp"
#include <mmsystem.h>

#include "quadtree.h"
Expand Down Expand Up @@ -238,7 +238,7 @@ class CoverThread : public CThread
typedef float Cover[4];

public:
CoverThread (u32 ID, u32 _start, u32 _end) : CThread(ID)
CoverThread (u32 ID, u32 _start, u32 _end) : CThread(ID, clMsg)
{
Nstart = _start;
Nend = _end;
Expand Down Expand Up @@ -574,7 +574,7 @@ void xrCover (bool pure_covers)

// Start threads, wait, continue --- perform all the work
u32 start_time = timeGetTime();
CThreadManager Threads;
CThreadManager Threads(Status, Progress);
u32 stride = g_nodes.size()/NUM_THREADS;
u32 last = g_nodes.size()-stride*(NUM_THREADS-1);
for (u32 thID=0; thID<NUM_THREADS; thID++) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrAI/compiler_light.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "stdafx.h"
#include "compiler.h"
#include "xrCDB/Intersect.hpp"
#include "xrThread.h"
#include "utils/xrUtil/xrThread.hpp"
#include <mmsystem.h>

const int LIGHT_Count =2;
Expand Down Expand Up @@ -78,7 +78,7 @@ class LightThread : public CThread
{
u32 Nstart, Nend;
public:
LightThread (u32 ID, u32 _start, u32 _end) : CThread(ID)
LightThread (u32 ID, u32 _start, u32 _end) : CThread(ID, clMsg)
{
Nstart = _start;
Nend = _end;
Expand Down
5 changes: 3 additions & 2 deletions src/utils/xrAI/game_spawn_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ extern LPCSTR generate_temp_file_name (LPCSTR header0, LPCSTR header1, string_

#define NO_MULTITHREADING

CGameSpawnConstructor::CGameSpawnConstructor (LPCSTR name, LPCSTR output, LPCSTR start, bool no_separator_check)
CGameSpawnConstructor::CGameSpawnConstructor (LPCSTR name, LPCSTR output, LPCSTR start, bool no_separator_check) :
#ifdef PROFILE_CRITICAL_SECTIONS
:m_critical_section(MUTEX_PROFILE_ID(CGameSpawnConstructor))
m_critical_section(MUTEX_PROFILE_ID(CGameSpawnConstructor)),
#endif // PROFILE_CRITICAL_SECTIONS
m_thread_manager(Status, Progress)
{
load_spawns (name,no_separator_check);
process_spawns ();
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrAI/game_spawn_constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "alife_space.h"
#include "xr_graph_merge.h"
#include "xrthread.h"
#include "utils/xrUtil/xrThread.hpp"
#include "graph_abstract.h"
#include "xrServer_Object_Base.h"
#include "spawn_constructor_space.h"
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrAI/level_spawn_constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include "xrthread.h"
#include "utils/xrUtil/xrThread.hpp"
#include "spawn_constructor_space.h"

class CLevelGraph;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrAI/level_spawn_constructor_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once

IC CLevelSpawnConstructor::CLevelSpawnConstructor (const CGameGraph::SLevel &level, CGameSpawnConstructor *game_spawn_constructor, bool no_separator_check) :
CThread (level.id())
CThread (level.id(), clMsg)
{
m_level = level;
m_game_spawn_constructor = game_spawn_constructor;
Expand Down
14 changes: 8 additions & 6 deletions src/utils/xrAI/vertex_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
#pragma once

template <bool bEuclidianHeuristics = true>
struct CVertexPath {

struct CVertexPath
{
#pragma pack(push,1)
template <template <typename _T> class T1>
struct DataStoragePath {
struct _vertex : public T1<_vertex> {
};
struct DataStoragePath
{
struct _vertex : public T1<_vertex>
{};
};
#pragma pack(pop)

template <template <typename _T> class _vertex>
class CDataStorage {
class CDataStorage
{
public:
typedef typename DataStoragePath<_vertex>::_vertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
Expand Down
1 change: 1 addition & 0 deletions src/utils/xrAI/xrAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#pragma comment(lib,"xrcdb.LIB")
#pragma comment(lib,"MagicFM.LIB")
#pragma comment(lib,"xrCore.LIB")
#pragma comment(lib, "xrUtil.lib")

extern LPCSTR LEVEL_GRAPH_NAME;

Expand Down
2 changes: 0 additions & 2 deletions src/utils/xrAI/xrAI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@
<ClCompile Include="verify_level_graph.cpp" />
<ClCompile Include="xrAI.cpp" />
<ClCompile Include="xrCrossTable.cpp" />
<ClCompile Include="xrThread.cpp" />
<ClCompile Include="xr_graph_merge.cpp" />
<ClCompile Include="_buildnodes_view.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -481,7 +480,6 @@
<ClInclude Include="xrAI.h" />
<ClInclude Include="xrCrossTable.h" />
<ClInclude Include="xrShaderTypes.h" />
<ClInclude Include="xrThread.h" />
<ClInclude Include="xr_graph_merge.h" />
<ClInclude Include="_d3d_extensions.h" />
</ItemGroup>
Expand Down
6 changes: 0 additions & 6 deletions src/utils/xrAI/xrAI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,6 @@
<ClCompile Include="xrAI.cpp">
<Filter>Compiler\Kernel</Filter>
</ClCompile>
<ClCompile Include="xrThread.cpp">
<Filter>Compiler\Kernel</Filter>
</ClCompile>
<ClCompile Include="cl_log.cpp">
<Filter>Compiler\Kernel\Log</Filter>
</ClCompile>
Expand Down Expand Up @@ -453,9 +450,6 @@
<ClInclude Include="xrShaderTypes.h">
<Filter>Compiler\Kernel</Filter>
</ClInclude>
<ClInclude Include="xrThread.h">
<Filter>Compiler\Kernel</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Compiler\Kernel\Resource Files</Filter>
</ClInclude>
Expand Down
57 changes: 0 additions & 57 deletions src/utils/xrAI/xrThread.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions src/utils/xrAI/xrThread.h

This file was deleted.

57 changes: 0 additions & 57 deletions src/utils/xrDO_Light/xrThread.cpp

This file was deleted.

38 changes: 0 additions & 38 deletions src/utils/xrDO_Light/xrThread.h

This file was deleted.

1 change: 1 addition & 0 deletions src/utils/xrLC/xrLC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#pragma comment(lib,"FreeImage.lib")
#pragma comment(lib,"xrCore.lib")
#pragma comment(lib,"xrLC_Light.lib")
#pragma comment(lib, "xrUtil.lib")

#define PROTECTED_BUILD

Expand Down
6 changes: 3 additions & 3 deletions src/utils/xrLC/xrLight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "build.h"

#include "../xrlc_light/xrdeflector.h"
#include "../xrlc_light/xrThread.h"
#include "utils/xrUtil/xrThread.hpp"
#include "../xrLC_Light/xrLC_GlobalData.h"
#include "../xrLC_Light/xrLightVertex.h"

Expand All @@ -26,7 +26,7 @@ class CLMThread : public CThread
CDB::COLLIDER DB;
base_lighting LightsSelected;
public:
CLMThread (u32 ID) : CThread(ID)
CLMThread (u32 ID) : CThread(ID, clMsg)
{
// thMonitor= TRUE;
thMessages = FALSE;
Expand Down Expand Up @@ -90,7 +90,7 @@ for(u32 dit = 0; dit<lc_global_data()->g_deflectors().size(); dit++)

// Main process (4 threads)
Status ("Lighting...");
CThreadManager threads;
CThreadManager threads(Status, Progress);
const u32 thNUM = 6;
CTimer start_time; start_time.Start();
for (int L=0; L<thNUM; L++) threads.start(xr_new<CLMThread> (L));
Expand Down
Loading

0 comments on commit 7a05d41

Please sign in to comment.