mirror of
https://github.com/crioux/turbo-linecount.git
synced 2024-10-27 17:24:01 +00:00
cleanup
This commit is contained in:
parent
90484b4874
commit
2c86bfd244
@ -1,9 +1,3 @@
|
|||||||
#if defined(__CYGWIN__) || defined(__linux__) || defined(__MINGW32__)
|
|
||||||
#ifndef _LARGEFILE64_SOURCE
|
|
||||||
#define _LARGEFILE64_SOURCE 1
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Turbo Linecount
|
// Turbo Linecount
|
||||||
// Copyright 2015, Christien Rioux
|
// Copyright 2015, Christien Rioux
|
||||||
@ -21,7 +15,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
///////////////////////////// Platform specific
|
///////////////////////////// Platform specific
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32)
|
||||||
|
|
||||||
// Windows
|
// Windows
|
||||||
#define LCOPENFILE(name) CreateFile(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
|
#define LCOPENFILE(name) CreateFile(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
|
||||||
@ -422,7 +416,11 @@ bool CLineCount::countLines(tlc_linecount_t & linecount)
|
|||||||
if (!createThread(i))
|
if (!createThread(i))
|
||||||
{
|
{
|
||||||
setLastError(ECHILD, _T("failed to create counting thread"));
|
setLastError(ECHILD, _T("failed to create counting thread"));
|
||||||
|
|
||||||
m_thread_fail = true;
|
m_thread_fail = true;
|
||||||
|
|
||||||
|
m_actual_thread_count = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,14 +430,12 @@ bool CLineCount::countLines(tlc_linecount_t & linecount)
|
|||||||
for (int i = 0; i < m_actual_thread_count; i++)
|
for (int i = 0; i < m_actual_thread_count; i++)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (m_threads[i] != NULL)
|
|
||||||
{
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
success = (WaitForSingleObject(m_threads[i], INFINITE) == WAIT_OBJECT_0);
|
success = (WaitForSingleObject(m_threads[i], INFINITE) == WAIT_OBJECT_0);
|
||||||
#else
|
#else
|
||||||
success = pthread_join(m_threads[i], NULL) == 0;
|
success = pthread_join(m_threads[i], NULL) == 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user