-
Notifications
You must be signed in to change notification settings - Fork 0
/
DsaOp.cpp
51 lines (45 loc) · 1 KB
/
DsaOp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <syslog.h>
#include "DsaOp.h"
namespace IrvCS
{
DsaOp::DsaOp(const DsaId dsaId, const DsaCmd dsaCmd,
DsaController &controller, OpContext *context)
:Thread(Detached), id_(dsaId),cmd_(dsaCmd),
controller_(controller), context_(context)
{
if (cmd_ == Release)
{
timeout_=DSA_RELEASE_TIMEOUT;
} else
{
timeout_=DSA_DEPLOY_TIMEOUT;
}
}
/**
* Run the DSA Operation in the thread
**/
void *DsaOp::run()
{
syslog(LOG_INFO, "Executing DSA Operation");
OpStatus status=controller_.performDsaOperation(id_, cmd_, timeout_);
if (status == StatOk)
{
syslog(LOG_INFO, "Completed DSA Operation");
} else if (status == StatTimeOut)
{
syslog(LOG_WARNING, "DSA Operation did not finish");
} else
{
syslog(LOG_ERR, "DSA Operation status %d", status);
}
context_->setStatus(status);
delete this;
}
DsaOp::~DsaOp()
{
if (NULL != context_)
{
delete context_;
}
}
}