[Boost.Asio coroutines] Question about HTTPServer4 examples

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Boost.Asio coroutines] Question about HTTPServer4 examples

Boost - Users mailing list
Hello everyone,
I have a small question regarding Boost.Asio stackless coroutines, and especially the HTTP server 4 example provided on the website (https://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/example/cpp03/http/server4/server.cpp).
I noticed that in the example, the socket_ shared pointer is being reset at every async_accept loop, basically deleting (?) the value it points to every time a new socket is accepted, since there seems to be only one shared_pointer instance, stored in a property of the server class.
How would eventual forks be able to use the newly accepted socket, if the main loop resets the pointer? Coroutine forking does not create a copy of the process like with POSIX forks (=> another shared pointer pointing to the same object); does it clone the coroutine object, along with all its properties?
 
Thanks,
Daniil Gentili

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Boost.Asio coroutines] Question about HTTPServer4 examples

Boost - Users mailing list
Welp, figured everything out by reading some c++ docs.
Thank you so much for the awesome libraries, I think I've never used such a complete and powerful set of libraries, before.
Daniil Gentili
 
26.04.2019, 15:42, "[hidden email]" <[hidden email]>:
Hello everyone,
I have a small question regarding Boost.Asio stackless coroutines, and especially the HTTP server 4 example provided on the website (https://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/example/cpp03/http/server4/server.cpp).
I noticed that in the example, the socket_ shared pointer is being reset at every async_accept loop, basically deleting (?) the value it points to every time a new socket is accepted, since there seems to be only one shared_pointer instance, stored in a property of the server class.
How would eventual forks be able to use the newly accepted socket, if the main loop resets the pointer? Coroutine forking does not create a copy of the process like with POSIX forks (=> another shared pointer pointing to the same object); does it clone the coroutine object, along with all its properties?
 
Thanks,
Daniil Gentili

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users