Commit 53ffcb26 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e7574978
...@@ -86,6 +86,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: ...@@ -86,6 +86,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
def loadblk(self, blk, buf): return self.zself.loadblk(blk, buf) def loadblk(self, blk, buf): return self.zself.loadblk(blk, buf)
def storeblk(self, blk, buf): return self.zself.storeblk(blk, buf) def storeblk(self, blk, buf): return self.zself.storeblk(blk, buf)
# blkmmapper is pycapsule with virtmem mmap functions for _ZBigFile. # blkmmapper is pycapsule with virtmem mmap functions for _ZBigFile.
# The functions rely on .wfileh being initialized by .fileh_open() # The functions rely on .wfileh being initialized by .fileh_open()
blkmmapper = PyCapsule_New(<void*>&ZBigFile_mmap_ops, "wendelin.bigfile.IBlkMMapper", NULL) blkmmapper = PyCapsule_New(<void*>&ZBigFile_mmap_ops, "wendelin.bigfile.IBlkMMapper", NULL)
...@@ -119,7 +120,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: ...@@ -119,7 +120,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
# XXX move -> .py ? # XXX move -> .py ?
cdef wcfs.PyConn pywconnOf(zconn): cdef wcfs.PyConn pywconnOf(zconn):
assert isinstance(zconn, ZConnection) assert isinstance(zconn, ZConnection)
assert zconn.opened # XXX needed assert zconn.opened # XXX needed?
# XXX locking # XXX locking
wconn = getattr(zconn, '_wcfs_wconn', None) wconn = getattr(zconn, '_wcfs_wconn', None)
...@@ -149,7 +150,7 @@ class ZSync: ...@@ -149,7 +150,7 @@ class ZSync:
# .wconn # .wconn
def __init__(zsync, zconn, wconn): def __init__(zsync, zconn, wconn):
print('ZSync %r %r' % (zconn, wconn)) #print('ZSync %r %r' % (zconn, wconn))
assert zconn.open assert zconn.open
zsync.zconn = zconn # XXX -> weakref zsync.zconn = zconn # XXX -> weakref
zsync.wconn = wconn zsync.wconn = wconn
...@@ -161,11 +162,11 @@ class ZSync: ...@@ -161,11 +162,11 @@ class ZSync:
# tm.commit() # zconn.at updated again # tm.commit() # zconn.at updated again
zconn.onResyncCallback(zsync) zconn.onResyncCallback(zsync)
# TODO zconn dealloc -> wconn.close
# DB resyncs .zconn onto new database view. # DB resyncs .zconn onto new database view.
# -> resync .wconn to updated database view of ZODB connection. # -> resync .wconn to updated database view of ZODB connection.
def on_connection_resync(zsync): def on_connection_resync(zsync):
#print('\nZZZSync.resync %r %r' % (zsync.zconn, zsync.wconn)) #print('\nZZZSync.resync %r %r' % (zsync.zconn, zsync.wconn))
#import traceback; traceback.print_stack() #import traceback; traceback.print_stack()
zsync.wconn.resync(zconn_at(zsync.zconn)) zsync.wconn.resync(zconn_at(zsync.zconn))
# TODO zconn dealloc -> wconn.close
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _WENDELIN_COMPAT_PY2_H #define _WENDELIN_COMPAT_PY2_H
/* Wendelin. Python2 compatibility /* Wendelin. Python2 compatibility
* Copyright (C) 2014-2019 Nexedi SA and Contributors. * Copyright (C) 2014-2020 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com> * Kirill Smelkov <kirr@nexedi.com>
* *
* This program is free software: you can Use, Study, Modify and Redistribute * This program is free software: you can Use, Study, Modify and Redistribute
...@@ -102,6 +102,15 @@ static inline PyThreadState * _PyThreadState_UncheckedGet(void) ...@@ -102,6 +102,15 @@ static inline PyThreadState * _PyThreadState_UncheckedGet(void)
# error "You are using CPython 3.5.X series. Upgrade your CPython to >= 3.5.2 to get _PyThreadState_UncheckedGet() support." # error "You are using CPython 3.5.X series. Upgrade your CPython to >= 3.5.2 to get _PyThreadState_UncheckedGet() support."
#endif #endif
/* determine if current thread holds the GIL
* https://stackoverflow.com/a/25666624/9456786 */
#if PY_MAJOR_VERSION < 3
static inline int PyGILState_Check(void)
{
// XXX do we really need it?
abort();
}
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
......
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