Commit f72b7f1c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 19eaac56
...@@ -59,8 +59,13 @@ cdef class PyWatchLink: ...@@ -59,8 +59,13 @@ cdef class PyWatchLink:
cdef WatchLink *wlink cdef WatchLink *wlink
def __xinit__(PyWatchLink pywlink, PyWCFS pywc): def __xinit__(PyWatchLink pywlink, PyWCFS pywc):
_ = wcfs_openwatch_pyexc(pywc.wc) with nogil:
# XXX _ = wcfs_openwatch_pyexc(pywc.wc)
pywlink.wlink = _.first
err = _.second
if err != nil:
raise RuntimeError(err.Error()) # XXX exc class?
def close(PyWatchLink pywlink): def close(PyWatchLink pywlink):
with nogil: with nogil:
......
...@@ -28,6 +28,9 @@ using std::string; ...@@ -28,6 +28,9 @@ using std::string;
#include <tuple> #include <tuple>
using std::tuple; using std::tuple;
#include <utility>
using std::pair;
#include "wcfs_misc.h" #include "wcfs_misc.h"
struct Conn; struct Conn;
...@@ -42,7 +45,7 @@ struct WCFS { ...@@ -42,7 +45,7 @@ struct WCFS {
tuple<Conn*, error> connect(zodb::Tid at); tuple<Conn*, error> connect(zodb::Tid at);
string _path(const string &obj); string _path(const string &obj);
tuple<os::File, error> _open(const string &path, int flags=O_RDONLY); tuple<os::File, error> _open(const string &path, int flags=O_RDONLY);
tuple<WatchLink*, error> _openwatch(); pair<WatchLink*, error> _openwatch();
}; };
......
...@@ -38,6 +38,10 @@ using namespace golang; ...@@ -38,6 +38,10 @@ using namespace golang;
#include <string> #include <string>
using std::string; using std::string;
#include <utility>
using std::pair;
using std::make_pair;
#include <tuple> #include <tuple>
using std::tuple; using std::tuple;
using std::make_tuple; using std::make_tuple;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
// _openwatch opens new watch link on wcfs. // _openwatch opens new watch link on wcfs.
tuple<WatchLink*, error> WCFS::_openwatch() { pair<WatchLink*, error> WCFS::_openwatch() {
WCFS *wc = this; WCFS *wc = this;
// head/watch handle. // head/watch handle.
...@@ -33,7 +33,7 @@ tuple<WatchLink*, error> WCFS::_openwatch() { ...@@ -33,7 +33,7 @@ tuple<WatchLink*, error> WCFS::_openwatch() {
error err; error err;
tie(f, err) = wc->_open("head/watch", O_RDWR); tie(f, err) = wc->_open("head/watch", O_RDWR);
if (err != nil) if (err != nil)
return make_tuple((WatchLink *)NULL, err); return make_pair((WatchLink *)NULL, err);
WatchLink *wlink = new(WatchLink); WatchLink *wlink = new(WatchLink);
wlink->_wc = wc; wlink->_wc = wc;
...@@ -49,7 +49,7 @@ tuple<WatchLink*, error> WCFS::_openwatch() { ...@@ -49,7 +49,7 @@ tuple<WatchLink*, error> WCFS::_openwatch() {
wlink->_serveWG.go(wlink._serveRX) wlink->_serveWG.go(wlink._serveRX)
#endif #endif
return make_tuple(wlink, nil); return make_pair(wlink, nil);
} }
void WatchLink::_closeTX() { void WatchLink::_closeTX() {
......
...@@ -85,7 +85,7 @@ class WatchLink { ...@@ -85,7 +85,7 @@ class WatchLink {
#endif #endif
public: public:
friend tuple<WatchLink*, error> WCFS::_openwatch(); friend pair<WatchLink*, error> WCFS::_openwatch();
error close(); error close();
error recvReq(context::Context *ctx, PinReq *rx_into); error recvReq(context::Context *ctx, PinReq *rx_into);
tuple<string, error> sendReq(context::Context *ctx, const string &req); tuple<string, error> sendReq(context::Context *ctx, const string &req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment