Added: #1440 Initial code for beginning the build task

--HG--
branch : build_pipeline_v3
hg/feature/build_pipeline_v3
kaetemi 12 years ago
parent e54956bf0f
commit d28d23645e

@ -32,6 +32,7 @@
// NeL includes // NeL includes
#include <nel/misc/debug.h> #include <nel/misc/debug.h>
#include <nel/misc/mutex.h>
// Project includes // Project includes
#include "info_flags.h" #include "info_flags.h"
@ -48,9 +49,12 @@ using namespace NLNET;
namespace PIPELINE { namespace PIPELINE {
#define PIPELINE_INFO_SLAVE_RELOAD_SHEETS "SLAVE_RELOAD_SHEETS" #define PIPELINE_INFO_SLAVE_RELOAD_SHEETS "S_RELOAD_SHEETS"
#define PIPELINE_ERROR_SHEETS_CRC32_FAILED "Failed sheets CRC32. Sheets were modified inbetween launching services. This causes newly loaded services to be out of sync. Not allowed. Reload the sheets from the master service, and restart this slave service" #define PIPELINE_ERROR_SHEETS_CRC32_FAILED "Failed sheets CRC32. Sheets were modified inbetween launching services. This causes newly loaded services to be out of sync. Not allowed. Reload the sheets from the master service, and restart this slave service"
#define PIPELINE_INFO_STATUS_UPDATE_MASTER "S_ST_UPD_MASTER"
#define PIPELINE_INFO_STATUS_UPDATE_SLAVE "S_ST_UPD_SLAVE"
enum TRequestState enum TRequestState
{ {
REQUEST_NONE, REQUEST_NONE,
@ -73,11 +77,23 @@ public:
bool m_TestCommand; bool m_TestCommand;
TRequestState m_ReloadSheetsState; TRequestState m_ReloadSheetsState;
bool m_BuildReadyState; bool m_BuildReadyState;
enum TSlaveTaskState
{
IDLE_WAIT_MASTER,
STATUS_UPDATE,
// ...
};
TSlaveTaskState m_SlaveTaskState;
NLMISC::CSynchronized<bool> m_StatusUpdateMasterDone;
NLMISC::CSynchronized<bool> m_StatusUpdateSlaveDone;
public: public:
CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false), m_ReloadSheetsState(REQUEST_NONE), m_BuildReadyState(false) CModulePipelineSlave() : m_Master(NULL), m_TestCommand(false), m_ReloadSheetsState(REQUEST_NONE), m_BuildReadyState(false), m_SlaveTaskState(IDLE_WAIT_MASTER), m_StatusUpdateMasterDone("StatusUpdateMasterDone"), m_StatusUpdateSlaveDone("StatusUpdateSlaveDone")
{ {
NLMISC::CSynchronized<bool>::CAccessor(&m_StatusUpdateMasterDone).value() = false;
NLMISC::CSynchronized<bool>::CAccessor(&m_StatusUpdateSlaveDone).value() = false;
} }
virtual ~CModulePipelineSlave() virtual ~CModulePipelineSlave()
@ -155,11 +171,41 @@ public:
CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_SLAVE_RELOAD_SHEETS); CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_SLAVE_RELOAD_SHEETS);
} }
} }
switch (m_SlaveTaskState)
{
case IDLE_WAIT_MASTER:
// Keep calm and carry on
break;
case STATUS_UPDATE:
{
if (NLMISC::CSynchronized<bool>::CAccessor(&m_StatusUpdateMasterDone).value()
&& NLMISC::CSynchronized<bool>::CAccessor(&m_StatusUpdateSlaveDone).value())
{
// Done with the status updating, now do something fancey
// ... TODO ...
}
}
break;
}
// Nothing to do here, move along
} }
///////////////////////////////////////////////////////////////////
/// Begin with the status update of the current task
void beginTaskStatusUpdate()
{
}
///////////////////////////////////////////////////////////////////
virtual void startBuildTask(NLNET::IModuleProxy *sender, const std::string &projectName, const uint32 &pluginId) virtual void startBuildTask(NLNET::IModuleProxy *sender, const std::string &projectName, const uint32 &pluginId)
{ {
// TODO // TODO
// Start the status update for master and slave.
//this->queueModuleTask //this->queueModuleTask
CModulePipelineMasterProxy master(sender); CModulePipelineMasterProxy master(sender);
@ -176,10 +222,14 @@ public:
if (m_TestCommand) if (m_TestCommand)
{ {
endedRunnableTask(); endedRunnableTask();
m_SlaveTaskState = IDLE_WAIT_MASTER;
} }
else else
{ {
nlwarning("NOT_IMPLEMENTED"); nlassert(m_SlaveTaskState == STATUS_UPDATE);
// Notify the update function that the master update has arrived.
NLMISC::CSynchronized<bool>::CAccessor(&m_StatusUpdateMasterDone).value() = true;
CInfoFlags::getInstance()->removeFlag(PIPELINE_INFO_STATUS_UPDATE_SLAVE);
} }
} }

Loading…
Cancel
Save