MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / IO_Thread

Method IO_Thread

pcsx2/DEV9/ATA/ATA_Transfer.cpp:16–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#endif
15
16void ATA::IO_Thread()
17{
18 std::unique_lock ioWaitHandle(ioMutex);
19 ioThreadIdle_bool = false;
20 ioWaitHandle.unlock();
21
22 while (true)
23 {
24 ioWaitHandle.lock();
25 ioThreadIdle_bool = true;
26 ioThreadIdle_cv.notify_all();
27
28 ioReady.wait(ioWaitHandle, [&] { return ioRead | ioWrite; });
29 ioThreadIdle_bool = false;
30
31 int ioType = -1;
32 if (ioRead)
33 ioType = 0;
34 else if (ioWrite)
35 ioType = 1;
36
37 ioWaitHandle.unlock();
38
39 //Read or Write
40 if (ioType == 0)
41 IO_Read();
42 else if (ioType == 1)
43 {
44 if (!IO_Write())
45 {
46 if (ioClose.load())
47 {
48 ioClose.store(false);
49 ioWaitHandle.lock();
50 ioThreadIdle_bool = true;
51 ioWaitHandle.unlock();
52 return;
53 }
54 }
55 }
56 }
57}
58
59void ATA::IO_Read()
60{

Callers

nothing calls this directly

Calls 5

unlockMethod · 0.80
notify_allMethod · 0.80
lockMethod · 0.45
waitMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected