@@ -361,7 +361,7 @@ std::optional<std::string_view> CMappingLineReader::GetNextLine()
361
361
// ////////////////////////////////////////////////////////////////////////
362
362
// ////////////////////////////////////////////////////////////////////////
363
363
364
- CLockFreeLineReader::CLockFreeLineReader ()
364
+ CSpinlockLineReader::CSpinlockLineReader ()
365
365
{
366
366
this ->_buffer1 .Allocate (ReadBufferSize);
367
367
if (this ->_buffer1 .ptr != nullptr )
@@ -370,7 +370,7 @@ CLockFreeLineReader::CLockFreeLineReader()
370
370
}
371
371
}
372
372
373
- bool CLockFreeLineReader ::Open (const wchar_t * const filename)
373
+ bool CSpinlockLineReader ::Open (const wchar_t * const filename)
374
374
{
375
375
if (this ->_buffer1 .ptr == nullptr || filename == nullptr )
376
376
{
@@ -389,32 +389,32 @@ bool CLockFreeLineReader::Open(const wchar_t* const filename)
389
389
this ->_bufferData = std::string_view (this ->_buffer1 .ptr , 0 );
390
390
this ->_firstBufferIsActive = true ;
391
391
392
- const bool initLockFreeOk = this ->_file .LockFreecInit ();
393
- if (!initLockFreeOk )
392
+ const bool initSpinlockOk = this ->_file .SpinlockInit ();
393
+ if (!initSpinlockOk )
394
394
{
395
395
this ->_file .Close ();
396
396
return false ;
397
397
}
398
398
399
- const bool readStartOk = this ->_file .LockFreeReadStart (this ->_buffer2 .ptr + ReadBufferOffset, ReadChunkSize);
399
+ const bool readStartOk = this ->_file .SpinlockReadStart (this ->_buffer2 .ptr + ReadBufferOffset, ReadChunkSize);
400
400
if (!readStartOk)
401
401
{
402
- this ->_file .LockFreecClean ();
402
+ this ->_file .SpinlockClean ();
403
403
this ->_file .Close ();
404
404
return false ;
405
405
}
406
406
407
407
return true ;
408
408
}
409
409
410
- void CLockFreeLineReader ::Close ()
410
+ void CSpinlockLineReader ::Close ()
411
411
{
412
- this ->_file .LockFreecClean ();
412
+ this ->_file .SpinlockClean ();
413
413
this ->_file .Close ();
414
414
}
415
415
416
416
__declspec (noinline) // noinline is added to help CPU profiling in release version
417
- std::optional<std::string_view> CLockFreeLineReader ::GetNextLine()
417
+ std::optional<std::string_view> CSpinlockLineReader ::GetNextLine()
418
418
{
419
419
if (this ->_buffer1 .ptr == nullptr )
420
420
{
@@ -446,15 +446,15 @@ std::optional<std::string_view> CLockFreeLineReader::GetNextLine()
446
446
memcpy (newDataBufferPtr, this ->_bufferData .data (), prefixLength);
447
447
448
448
size_t readBytes = 0 ;
449
- const bool readCompleteOk = this ->_file .LockFreeReadWait (readBytes);
449
+ const bool readCompleteOk = this ->_file .SpinlockReadWait (readBytes);
450
450
if (!readCompleteOk)
451
451
{
452
452
// Previous reading failed
453
453
return {};
454
454
}
455
455
456
456
// Read missing data:
457
- const bool readOk = this ->_file .LockFreeReadStart (currentBuffer.ptr + ReadBufferOffset, ReadChunkSize);
457
+ const bool readOk = this ->_file .SpinlockReadStart (currentBuffer.ptr + ReadBufferOffset, ReadChunkSize);
458
458
if (!readOk)
459
459
{
460
460
// New reading failed
0 commit comments