Closed justnull closed 2 years ago
https://github.com/chenshuo/muduo/blob/90920bbad80e544da9a8a94b16ad8ab4bb66e652/examples/idleconnection/echo.h#L9 https://www.boost.org/doc/libs/1_54_0/libs/circular_buffer/doc/circular_buffer.html#threadsafety If multiple threads access a single circular_buffer, and at least one of the threads may potentially write, then the user is responsible for ensuring mutual exclusion between the threads during the container accesses. The mutual exclusion between the threads can be achieved by wrapping operations of the underlying circular_buffer with a lock acquisition and release.
does ::onCnnection and ::onMessage always run in a single thread?
muduo/examples/idleconnection is a single thread program.
https://github.com/chenshuo/muduo/blob/90920bbad80e544da9a8a94b16ad8ab4bb66e652/examples/idleconnection/echo.h#L9 https://www.boost.org/doc/libs/1_54_0/libs/circular_buffer/doc/circular_buffer.html#threadsafety If multiple threads access a single circular_buffer, and at least one of the threads may potentially write, then the user is responsible for ensuring mutual exclusion between the threads during the container accesses. The mutual exclusion between the threads can be achieved by wrapping operations of the underlying circular_buffer with a lock acquisition and release.
does ::onCnnection and ::onMessage always run in a single thread?