File: winimpl.pxi

package info (click to toggle)
paraview 3.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 173,864 kB
  • ctags: 192,754
  • sloc: cpp: 1,497,065; ansic: 607,818; tcl: 47,394; xml: 47,108; python: 29,870; perl: 3,117; java: 2,428; yacc: 1,853; sh: 833; asm: 471; lex: 393; pascal: 228; makefile: 189; fortran: 31
file content (21 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
cdef void win_memory_pydecref(void *ob) with gil:
    Py_DECREF(<object>ob)

cdef int PyMPI_Win_memory_del(MPI_Win w, int k, void *v, void *xs) nogil:
    if  v != NULL:
        if Py_IsInitialized():
            win_memory_pydecref(v)
    return 0

cdef int PyMPI_Win_set_attr_memory(MPI_Win win, object memory) except -1:
    if memory is None: return 0
    # create keyval for memory object
    global PyMPI_KEYVAL_WIN_MEMORY
    if PyMPI_KEYVAL_WIN_MEMORY == MPI_KEYVAL_INVALID:
        CHKERR( MPI_Win_create_keyval(MPI_WIN_NULL_COPY_FN,
                                      PyMPI_Win_memory_del,
                                      &PyMPI_KEYVAL_WIN_MEMORY, NULL) )
    # hold a reference to the object exposing windows memory
    CHKERR( MPI_Win_set_attr(win, PyMPI_KEYVAL_WIN_MEMORY, <void*>memory) )
    Py_INCREF(memory)
    return 0