Loading src/tinyfiber.cpp +2 −2 Changes for src/tinyfiber.cpp: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ namespace { thread_local TfbContext* l_my_fiber_system; static void fiber_main_loop(void* fiber_system) static void __stdcall fiber_main_loop(void* fiber_system) { if (fiber_system == nullptr) return; Loading Loading @@ -173,7 +173,7 @@ static int worker_function(TfbContext& fs) return 0; } static void start_workers(void* fiber_system) static void __stdcall start_workers(void* fiber_system) { if (fiber_system == nullptr) return; Loading src/tinyringbuffer.hpp +5 −4 Changes for src/tinyringbuffer.hpp: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public: free(); } // To make it easier to use BSS TinyRingBufferStatus init(int64_t buffer_size) { if (buffer_size & 0xffff) Loading @@ -73,8 +74,8 @@ public: while (tries < 5 && m_buffer == nullptr) { m_buffer_size = buffer_size; size_t virtual_size = m_buffer_size * 3; // todo(markusl): why 3 and not 2 ? m_buffer = (uint8_t*)VirtualAlloc(nullptr, virtual_size, MEM_RESERVE, PAGE_NOACCESS); int64_t virtual_size = m_buffer_size * 3; // todo(markusl): why 3 and not 2 ? m_buffer = (uint8_t*)VirtualAlloc(nullptr, (SIZE_T)virtual_size, MEM_RESERVE, PAGE_NOACCESS); VirtualFree(m_buffer, 0, MEM_RELEASE); if (m_buffer != nullptr) Loading @@ -87,8 +88,8 @@ public: } else { m_map = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, m_buffer_size, m_buffer); void* map2 = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, m_buffer_size, m_buffer + m_buffer_size); m_map = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, (SIZE_T)m_buffer_size, m_buffer); void* map2 = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, (SIZE_T)m_buffer_size, m_buffer + m_buffer_size); if (m_map == nullptr || map2 == nullptr) free(); Loading tests/tinyfiber_test.cpp +10 −3 Changes for tests/tinyfiber_test.cpp: 10 added lines, 3 removed lines. Original line number Diff line number Diff line /* MIT License Copyright (c) 2020 Markus Lindelöw Copyright (c) 2020 Markus Lindel�w Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal Loading @@ -27,6 +27,7 @@ SOFTWARE. #include "doctest.hpp" #include <atomic> #include <thread> #include <sstream> namespace tinyfiber { Loading Loading @@ -67,8 +68,14 @@ TEST_CASE("tinyfiber init/deinit simple") int sts = tfb_free(); // Then CHECK(start_id != run_id); CHECK(std::this_thread::get_id() == start_id); std::stringstream ss_start_id; // warning C4717 std::stringstream ss_run_id; ss_start_id << start_id; ss_run_id << run_id; CHECK(ss_start_id.str() != ss_run_id.str()); std::stringstream ss_now_id; ss_now_id << std::this_thread::get_id(); CHECK(ss_now_id.str() == ss_start_id.str()); CHECK(sts == 0); } Loading Loading
src/tinyfiber.cpp +2 −2 Changes for src/tinyfiber.cpp: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -74,7 +74,7 @@ namespace { thread_local TfbContext* l_my_fiber_system; static void fiber_main_loop(void* fiber_system) static void __stdcall fiber_main_loop(void* fiber_system) { if (fiber_system == nullptr) return; Loading Loading @@ -173,7 +173,7 @@ static int worker_function(TfbContext& fs) return 0; } static void start_workers(void* fiber_system) static void __stdcall start_workers(void* fiber_system) { if (fiber_system == nullptr) return; Loading
src/tinyringbuffer.hpp +5 −4 Changes for src/tinyringbuffer.hpp: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public: free(); } // To make it easier to use BSS TinyRingBufferStatus init(int64_t buffer_size) { if (buffer_size & 0xffff) Loading @@ -73,8 +74,8 @@ public: while (tries < 5 && m_buffer == nullptr) { m_buffer_size = buffer_size; size_t virtual_size = m_buffer_size * 3; // todo(markusl): why 3 and not 2 ? m_buffer = (uint8_t*)VirtualAlloc(nullptr, virtual_size, MEM_RESERVE, PAGE_NOACCESS); int64_t virtual_size = m_buffer_size * 3; // todo(markusl): why 3 and not 2 ? m_buffer = (uint8_t*)VirtualAlloc(nullptr, (SIZE_T)virtual_size, MEM_RESERVE, PAGE_NOACCESS); VirtualFree(m_buffer, 0, MEM_RELEASE); if (m_buffer != nullptr) Loading @@ -87,8 +88,8 @@ public: } else { m_map = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, m_buffer_size, m_buffer); void* map2 = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, m_buffer_size, m_buffer + m_buffer_size); m_map = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, (SIZE_T)m_buffer_size, m_buffer); void* map2 = MapViewOfFileEx(m_handle, FILE_MAP_ALL_ACCESS, 0, 0, (SIZE_T)m_buffer_size, m_buffer + m_buffer_size); if (m_map == nullptr || map2 == nullptr) free(); Loading
tests/tinyfiber_test.cpp +10 −3 Changes for tests/tinyfiber_test.cpp: 10 added lines, 3 removed lines. Original line number Diff line number Diff line /* MIT License Copyright (c) 2020 Markus Lindelöw Copyright (c) 2020 Markus Lindel�w Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal Loading @@ -27,6 +27,7 @@ SOFTWARE. #include "doctest.hpp" #include <atomic> #include <thread> #include <sstream> namespace tinyfiber { Loading Loading @@ -67,8 +68,14 @@ TEST_CASE("tinyfiber init/deinit simple") int sts = tfb_free(); // Then CHECK(start_id != run_id); CHECK(std::this_thread::get_id() == start_id); std::stringstream ss_start_id; // warning C4717 std::stringstream ss_run_id; ss_start_id << start_id; ss_run_id << run_id; CHECK(ss_start_id.str() != ss_run_id.str()); std::stringstream ss_now_id; ss_now_id << std::this_thread::get_id(); CHECK(ss_now_id.str() == ss_start_id.str()); CHECK(sts == 0); } Loading