-
-
Notifications
You must be signed in to change notification settings - Fork 335
/
WriteCoreFileJob.cpp
58 lines (42 loc) · 959 Bytes
/
WriteCoreFileJob.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
52
53
54
55
56
57
58
/*
* Copyright 2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "Jobs.h"
#include <Path.h>
#include <AutoLocker.h>
#include "DebuggerInterface.h"
#include "Team.h"
WriteCoreFileJob::WriteCoreFileJob(Team* team,
DebuggerInterface* interface, const entry_ref& path)
:
fKey(&path, JOB_TYPE_WRITE_CORE_FILE),
fTeam(team),
fDebuggerInterface(interface),
fTargetPath(path)
{
fDebuggerInterface->AcquireReference();
}
WriteCoreFileJob::~WriteCoreFileJob()
{
fDebuggerInterface->AcquireReference();
}
const JobKey&
WriteCoreFileJob::Key() const
{
return fKey;
}
status_t
WriteCoreFileJob::Do()
{
BPath path(&fTargetPath);
status_t error = path.InitCheck();
if (error != B_OK)
return error;
error = fDebuggerInterface->WriteCoreFile(path.Path());
if (error != B_OK)
return error;
AutoLocker< ::Team> teamLocker(fTeam);
fTeam->NotifyCoreFileChanged(path.Path());
return B_OK;
}