lib/nfs/Glue: destruct the NfsManager in the I/O thread
This allows eliminating the indirection code from the NfsConnection destructor.
This commit is contained in:
@@ -22,9 +22,9 @@
|
|||||||
#include "Lease.hxx"
|
#include "Lease.hxx"
|
||||||
#include "Domain.hxx"
|
#include "Domain.hxx"
|
||||||
#include "Callback.hxx"
|
#include "Callback.hxx"
|
||||||
|
#include "event/Loop.hxx"
|
||||||
#include "system/fd_util.h"
|
#include "system/fd_util.h"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "event/Call.hxx"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <nfsc/libnfs.h>
|
#include <nfsc/libnfs.h>
|
||||||
@@ -123,14 +123,13 @@ events_to_libnfs(unsigned i)
|
|||||||
|
|
||||||
NfsConnection::~NfsConnection()
|
NfsConnection::~NfsConnection()
|
||||||
{
|
{
|
||||||
|
assert(SocketMonitor::GetEventLoop().IsInside());
|
||||||
assert(new_leases.empty());
|
assert(new_leases.empty());
|
||||||
assert(active_leases.empty());
|
assert(active_leases.empty());
|
||||||
assert(callbacks.IsEmpty());
|
assert(callbacks.IsEmpty());
|
||||||
|
|
||||||
if (context != nullptr)
|
if (context != nullptr)
|
||||||
BlockingCall(SocketMonitor::GetEventLoop(), [this](){
|
DestroyContext();
|
||||||
DestroyContext();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -119,6 +119,9 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Must be run from EventLoop's thread.
|
||||||
|
*/
|
||||||
~NfsConnection();
|
~NfsConnection();
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "Glue.hxx"
|
#include "Glue.hxx"
|
||||||
#include "Manager.hxx"
|
#include "Manager.hxx"
|
||||||
#include "IOThread.hxx"
|
#include "IOThread.hxx"
|
||||||
|
#include "event/Call.hxx"
|
||||||
#include "util/Manual.hxx"
|
#include "util/Manual.hxx"
|
||||||
|
|
||||||
static Manual<NfsManager> nfs_glue;
|
static Manual<NfsManager> nfs_glue;
|
||||||
@@ -43,7 +44,7 @@ nfs_finish()
|
|||||||
if (--in_use > 0)
|
if (--in_use > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nfs_glue.Destruct();
|
BlockingCall(io_thread_get(), [](){ nfs_glue.Destruct(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
NfsConnection &
|
NfsConnection &
|
||||||
|
Reference in New Issue
Block a user