Coder Social home page Coder Social logo

Fails to compile on VS14 about asio HOT 8 CLOSED

chriskohlhoff avatar chriskohlhoff commented on June 14, 2024
Fails to compile on VS14

from asio.

Comments (8)

chriskohlhoff avatar chriskohlhoff commented on June 14, 2024

Please try the following diff and let me know if it fixes the problem, thanks.

diff --git a/asio/include/asio/detail/config.hpp b/asio/include/asio/detail/config.hpp
index 6207552..156f4e5 100644
--- a/asio/include/asio/detail/config.hpp
+++ b/asio/include/asio/detail/config.hpp
@@ -289,6 +289,11 @@
 #   endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
 #  endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
 # endif // defined(__GNUC__)
+# if defined(ASIO_MSVC)
+#  if (_MSC_VER >= 1900)
+#   define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
+#  endif // (_MSC_VER >= 1900)
+# endif // defined(ASIO_MSVC)
 # if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
 #  define ASIO_ERROR_CATEGORY_NOEXCEPT
 # endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)

from asio.

ned14 avatar ned14 commented on June 14, 2024

Yep, that worked, thank you. Tell me Chris, would you have any interest in a STL concurrent unordered map with concurrent safe erase and node splicing facilities? It could let you remove a lot of locking from io_service on POSIX and therefore substantially increase concurrency, potentially to the extent of the IOCP implementation? The single threaded performance loss is about 10% of a std::unordered_map on GCC and clang, and unfortunately over 50% on MSVC (so don't use it there until Microsoft catch up), but concurrency increases linearly with core count so it runs rings around an unordered_map even on a dual core CPU. Let me know if that sounds of interest.

from asio.

chriskohlhoff avatar chriskohlhoff commented on June 14, 2024

Are you using master? If so, the first step would be to try it in a separate implementation of an execution context, with the same members (run, run_one, stop, etc) as io_service. Are you able to put that together, at least as a partial prototype?

from asio.

ned14 avatar ned14 commented on June 14, 2024

It's more that on Linux, at least, your io_service implementation contends heavily on a std::mutex when one is scheduling a large number of small work items where multiple worker threads are available to run(). ASIO makes the choice of lock configurable if I remember rightly, but it would be even better if it didn't lock at all when scheduling i/o, or when worker threads are deciding what callbacks to execute. Obviously that's a substantial refactor of your current POSIX io_service implementation, it wouldn't be something I would prototype but I can certainly supply the proposed boost concurrent_unordered_map to you (note: no Boost is required, it's completely standalone). The fact it can concurrently safe erase is an enormous difference over split ordered list concurrent hash tables.

from asio.

ned14 avatar ned14 commented on June 14, 2024

For reference, my statement about ASIO io_service lack of concurrency has benchmarks at https://boostgsoc13.github.io/boost.afio/doc/html/afio/FAQ/closure_performance.html (see right hand column). v1.3 of the AFIO engine will use concurrent_unordered_map, and I should very substantially close the gap between AFIO and ASIO. v1.4 of the AFIO engine will use the new non-allocating constexpr future-promises which are essentially a functional elaboration of ASIO async_result, and with that I expect to eliminate almost all of the gap between AFIO and ASIO.

from asio.

zaphoyd avatar zaphoyd commented on June 14, 2024

I've also run into this issue (ASIO does not scale beyond 3-4 threads) which limits the concurrency of programs built using my WebSocket library, WebSocket++, when used with the ASIO based networking policy. If this thread turns into a serious effort to address this issue I'd be willing to put in some time, at minimum in testing & benchmarking and possibly writing code as well.

from asio.

Tyche avatar Tyche commented on June 14, 2024

The above patch introduces the following warning on VS 2015:
c:\dev_2015\project\asio-1.11.0\include\asio\detail\config.hpp(300): warning C4005: 'ASIO_ERROR_CATEGORY_NOEXCEPT': macro redefinition
1> c:\dev_2015\project\asio-1.11.0\include\asio\detail\config.hpp(286): note: see previous definition of 'ASIO_ERROR_CATEGORY_NOEXCEPT'

Either define would work
define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept

from asio.

ryanbartley avatar ryanbartley commented on June 14, 2024

I see the macro redefinition warning as well.

from asio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.