Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
ccp-chargeback
core
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
core
/
CcpThreadClass.cpp
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
88 lines (74 loc) · 1.28 KB
main
Breadcrumbs
core
/
CcpThreadClass.cpp
Copy path
Top
File metadata and controls
Code
Blame
88 lines (74 loc) · 1.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright © 2015 CCP ehf.
#include "include/CcpThread.h"
// CcpThread implementation cannot reside in CcpThread.cpp file because we
// cannot mix BLUEIMPORT and statically-linked functions in a single cpp file.
#if defined(_MSC_VER) && _MSC_VER <= 1700
CcpThread::CcpThread()
:m_thread( nullptr ),
m_id( 0 )
{
}
CcpThread::CcpThread( CcpThread&& other )
:m_thread( other.m_thread ),
m_id( other.m_id )
{
other.m_thread = nullptr;
other.m_id = 0;
}
CcpThread::~CcpThread()
{
if( joinable() )
{
std::terminate();
}
}
CcpThread& CcpThread::operator=( CcpThread&& other )
{
if( joinable() )
{
std::terminate();
}
if( &other == this )
{
return *this;
}
m_thread = other.m_thread;
m_id = other.m_id;
other.m_thread = nullptr;
other.m_id = 0;
return *this;
}
bool CcpThread::joinable() const
{
return m_thread != nullptr;
}
DWORD CcpThread::get_id() const
{
return m_id;
}
HANDLE CcpThread::native_handle()
{
return m_thread;
}
void CcpThread::join()
{
if( joinable() )
{
WaitForSingleObject( m_thread, INFINITE );
CloseHandle( m_thread );
m_thread = nullptr;
}
}
void CcpThread::detach()
{
if( joinable() )
{
CloseHandle( m_thread );
m_thread = nullptr;
}
}
void CcpThread::swap( CcpThread& other )
{
std::swap( m_thread, other.m_thread );
}
#endif
You can’t perform that action at this time.