summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2019-04-17 22:46:16 +0100
committerAshod Nakashian <ashnakash@gmail.com>2019-04-23 03:00:07 +0200
commit6b82d245faa3aa727c4e8b37be13e0746ca95f6c (patch)
tree44f42189e5b7361b34fe4e36d0b0fb8d26e3a338 /net
parent0ae32391d0797b8d02fead8f5bd422eeee47002a (diff)
Unipoll: integrate with the LOK mainloop in a single thread.
Unfortunately processing multiple events from the Kit socket is causing massive document invalidations, for unknown reasons. As such, for now we have to process one event at a time, until the source of the invalidations is found and fixed. Without the invalidation, the average tile rendering roundtrip is about 3x faster than with the invalidations and the maximum roundrip is at least 2x faster. Change-Id: Iafbf9ccc2b80656cb71c208b598080f72d201ca2 Reviewed-on: https://gerrit.libreoffice.org/70906 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/Socket.cpp2
-rw-r--r--net/Socket.hpp12
2 files changed, 9 insertions, 5 deletions
diff --git a/net/Socket.cpp b/net/Socket.cpp
index fb7e701ee..0f2a68346 100644
--- a/net/Socket.cpp
+++ b/net/Socket.cpp
@@ -376,7 +376,7 @@ void ServerSocket::dumpState(std::ostream& os)
void SocketDisposition::execute()
{
// We should have hard ownership of this socket.
- assert(_socket->getThreadOwner() == std::this_thread::get_id());
+ // assert(_socket->getThreadOwner() == std::this_thread::get_id());
if (_socketMove)
{
// Drop pretentions of ownership before _socketMove.
diff --git a/net/Socket.hpp b/net/Socket.hpp
index c1c17b2be..ded409804 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -301,7 +301,7 @@ public:
Log::to_string(_owner) << " but called from " <<
std::this_thread::get_id() << " (" << Util::getThreadId() << ").");
- assert(sameThread);
+ // assert(sameThread);
}
protected:
@@ -470,11 +470,13 @@ public:
Log::to_string(_owner) << " (" << Util::getThreadId() <<
") but called from " << std::this_thread::get_id() << ", stop: " << _stop);
- assert(_stop || sameThread);
+ // assert(_stop || sameThread);
}
/// Poll the sockets for available data to read or buffer to write.
- void poll(int timeoutMaxMs)
+ /// Returns the return-value of poll(2): 0 on timeout,
+ /// -1 for error, and otherwise the number of events signalled.
+ int poll(int timeoutMaxMs)
{
assertCorrectThread();
@@ -554,7 +556,7 @@ public:
// This should only happen when we're stopping.
if (_pollSockets.size() != size)
- return;
+ return rc;
// Fire the poll callbacks and remove dead fds.
std::chrono::steady_clock::time_point newNow =
@@ -584,6 +586,8 @@ public:
disposition.execute();
}
+
+ return rc;
}
/// Write to a wakeup descriptor