Browse Source
Merge pull request #876 from linkmauve/include-cleanups
Merge pull request #876 from linkmauve/include-cleanups
Cleanup includes, mostly in commonpull/15/merge
108 changed files with 374 additions and 402 deletions
-
4src/citra/citra.cpp
-
3src/citra/config.cpp
-
6src/citra/config.h
-
12src/citra/emu_window/emu_window_glfw.cpp
-
2src/citra/emu_window/emu_window_glfw.h
-
4src/citra_qt/bootmanager.cpp
-
2src/citra_qt/config.cpp
-
4src/citra_qt/config.h
-
2src/citra_qt/debugger/disassembler.cpp
-
5src/citra_qt/hotkeys.cpp
-
4src/citra_qt/hotkeys.h
-
6src/citra_qt/main.cpp
-
1src/common/CMakeLists.txt
-
1src/common/assert.h
-
1src/common/bit_field.h
-
10src/common/chunk_file.h
-
11src/common/common_funcs.h
-
2src/common/common_types.h
-
6src/common/emu_window.cpp
-
12src/common/emu_window.h
-
111src/common/fifo_queue.h
-
11src/common/file_util.cpp
-
3src/common/file_util.h
-
1src/common/logging/filter.h
-
4src/common/logging/log.h
-
1src/common/make_unique.h
-
11src/common/memory_util.cpp
-
4src/common/memory_util.h
-
5src/common/misc.cpp
-
55src/common/platform.h
-
11src/common/profiler.cpp
-
5src/common/profiler_reporting.h
-
9src/common/string_util.cpp
-
3src/common/string_util.h
-
10src/common/swap.h
-
1src/common/synchronized_wrapper.h
-
17src/common/thread.cpp
-
16src/common/thread.h
-
1src/core/arm/disassembler/load_symbol_map.cpp
-
5src/core/arm/dyncom/arm_dyncom.h
-
6src/core/arm/skyeye_common/vfp/vfp.cpp
-
4src/core/arm/skyeye_common/vfp/vfpsingle.cpp
-
3src/core/core.cpp
-
4src/core/core_timing.cpp
-
2src/core/file_sys/archive_backend.cpp
-
5src/core/file_sys/archive_extsavedata.cpp
-
7src/core/file_sys/archive_extsavedata.h
-
3src/core/file_sys/archive_romfs.cpp
-
4src/core/file_sys/archive_romfs.h
-
4src/core/file_sys/archive_savedata.cpp
-
7src/core/file_sys/archive_savedata.h
-
6src/core/file_sys/archive_savedatacheck.cpp
-
9src/core/file_sys/archive_savedatacheck.h
-
3src/core/file_sys/archive_sdmc.cpp
-
7src/core/file_sys/archive_sdmc.h
-
6src/core/file_sys/archive_systemsavedata.cpp
-
7src/core/file_sys/archive_systemsavedata.h
-
4src/core/file_sys/disk_archive.cpp
-
7src/core/file_sys/disk_archive.h
-
2src/core/file_sys/file_backend.h
-
2src/core/file_sys/ivfc_archive.cpp
-
4src/core/file_sys/ivfc_archive.h
-
1src/core/hle/hle.cpp
-
2src/core/hle/kernel/kernel.cpp
-
7src/core/hle/kernel/kernel.h
-
3src/core/hle/kernel/process.h
-
6src/core/hle/kernel/session.h
-
1src/core/hle/kernel/thread.h
-
2src/core/hle/kernel/vm_manager.cpp
-
1src/core/hle/kernel/vm_manager.h
-
2src/core/hle/result.h
-
2src/core/hle/service/dsp_dsp.h
-
10src/core/hle/service/fs/archive.cpp
-
13src/core/hle/service/fs/archive.h
-
4src/core/hle/service/gsp_gpu.cpp
-
3src/core/hle/service/gsp_gpu.h
-
1src/core/hle/service/hid/hid.cpp
-
16src/core/hle/service/hid/hid.h
-
3src/core/hle/service/service.h
-
75src/core/hle/service/soc_u.cpp
-
2src/core/hle/service/soc_u.h
-
1src/core/hle/service/y2r_u.cpp
-
2src/core/hle/service/y2r_u.h
-
6src/core/hle/shared_page.cpp
-
3src/core/hle/shared_page.h
-
11src/core/hw/gpu.cpp
-
1src/core/hw/gpu.h
-
2src/core/hw/lcd.cpp
-
1src/core/hw/lcd.h
-
4src/core/hw/y2r.cpp
-
3src/core/loader/elf.cpp
-
2src/core/loader/loader.cpp
-
8src/core/loader/loader.h
-
3src/core/loader/ncch.cpp
-
5src/core/mem_map.cpp
-
3src/core/memory.cpp
-
2src/core/memory.h
-
12src/video_core/command_processor.cpp
-
4src/video_core/command_processor.h
-
1src/video_core/debug_utils/debug_utils.cpp
@ -1,111 +0,0 @@ |
|||
#pragma once |
|||
|
|||
// a simple lockless thread-safe, |
|||
// single reader, single writer queue |
|||
|
|||
#include "common/atomic.h" |
|||
|
|||
namespace Common |
|||
{ |
|||
|
|||
template <typename T> |
|||
class FifoQueue |
|||
{ |
|||
public: |
|||
FifoQueue() : m_size(0) |
|||
{ |
|||
m_write_ptr = m_read_ptr = new ElementPtr(); |
|||
} |
|||
|
|||
~FifoQueue() |
|||
{ |
|||
// this will empty out the whole queue |
|||
delete m_read_ptr; |
|||
} |
|||
|
|||
u32 Size() const |
|||
{ |
|||
return m_size; |
|||
} |
|||
|
|||
bool Empty() const |
|||
{ |
|||
//return (m_read_ptr == m_write_ptr); |
|||
return (0 == m_size); |
|||
} |
|||
|
|||
T& Front() const |
|||
{ |
|||
return *m_read_ptr->current; |
|||
} |
|||
|
|||
template <typename Arg> |
|||
void Push(Arg&& t) |
|||
{ |
|||
// create the element, add it to the queue |
|||
m_write_ptr->current = new T(std::forward<Arg>(t)); |
|||
// set the next pointer to a new element ptr |
|||
// then advance the write pointer |
|||
m_write_ptr = m_write_ptr->next = new ElementPtr(); |
|||
Common::AtomicIncrement(m_size); |
|||
} |
|||
|
|||
void Pop() |
|||
{ |
|||
Common::AtomicDecrement(m_size); |
|||
ElementPtr *const tmpptr = m_read_ptr; |
|||
// advance the read pointer |
|||
m_read_ptr = m_read_ptr->next; |
|||
// set the next element to NULL to stop the recursive deletion |
|||
tmpptr->next = nullptr; |
|||
delete tmpptr; // this also deletes the element |
|||
} |
|||
|
|||
bool Pop(T& t) |
|||
{ |
|||
if (Empty()) |
|||
return false; |
|||
|
|||
t = std::move(Front()); |
|||
Pop(); |
|||
|
|||
return true; |
|||
} |
|||
|
|||
// not thread-safe |
|||
void Clear() |
|||
{ |
|||
m_size = 0; |
|||
delete m_read_ptr; |
|||
m_write_ptr = m_read_ptr = new ElementPtr(); |
|||
} |
|||
|
|||
private: |
|||
// stores a pointer to element |
|||
// and a pointer to the next ElementPtr |
|||
class ElementPtr |
|||
{ |
|||
public: |
|||
ElementPtr() : current(nullptr), next(nullptr) {} |
|||
|
|||
~ElementPtr() |
|||
{ |
|||
if (current) |
|||
{ |
|||
delete current; |
|||
// recusion ftw |
|||
if (next) |
|||
delete next; |
|||
} |
|||
} |
|||
|
|||
T *volatile current; |
|||
ElementPtr *volatile next; |
|||
}; |
|||
|
|||
ElementPtr *volatile m_write_ptr; |
|||
ElementPtr *volatile m_read_ptr; |
|||
volatile u32 m_size; |
|||
}; |
|||
|
|||
} |
|||
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue