swig: Add %thread directive for repo_sack.hpp for Python
The purpose is to enable multithread support in python. With the %thread directive, the Python GIL is released before entering the methods from repo_sack.hpp and acquired when exiting them. In case the methods are called in a thread, another thread is not blocked by it. This is especially important in case of loading repositories which can take a lot of time.
This commit is contained in:
parent
2b466777a8
commit
76c199b8fb
|
@ -1,5 +1,6 @@
|
|||
#if defined(SWIGPYTHON)
|
||||
%module(package="libdnf5", directors="1") repo
|
||||
%module("threads"=1, package="libdnf5", directors="1") repo
|
||||
%nothread;
|
||||
#elif defined(SWIGPERL)
|
||||
%module "libdnf5::repo"
|
||||
#elif defined(SWIGRUBY)
|
||||
|
@ -153,6 +154,10 @@ wrap_unique_ptr(RepoCallbacksUniquePtr, libdnf5::repo::RepoCallbacks);
|
|||
|
||||
%include "libdnf5/repo/repo_query.hpp"
|
||||
%template(SackRepoRepoQuery) libdnf5::sack::Sack<libdnf5::repo::Repo>;
|
||||
|
||||
#if defined(SWIGPYTHON)
|
||||
%thread;
|
||||
#endif
|
||||
%include "libdnf5/repo/repo_sack.hpp"
|
||||
%template(RepoSackWeakPtr) libdnf5::WeakPtr<libdnf5::repo::RepoSack, false>;
|
||||
|
||||
|
|
Loading…
Reference in New Issue