summaryrefslogtreecommitdiff
path: root/docs/dev/maintainer_notes.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev/maintainer_notes.txt')
-rw-r--r--docs/dev/maintainer_notes.txt82
1 files changed, 82 insertions, 0 deletions
diff --git a/docs/dev/maintainer_notes.txt b/docs/dev/maintainer_notes.txt
index 54a6147..8a59ccb 100644
--- a/docs/dev/maintainer_notes.txt
+++ b/docs/dev/maintainer_notes.txt
@@ -1,3 +1,85 @@
+L'adaptation a faire sur tkinter est la suivante :
+
+Il faut rendre partageable les macros ENTER_TCL, LEAVE_TCL,
+ENTER_OVERLAP, LEAVE_OVERLAP_TCL, ENTER_PYTHON, LEAVE_PYTHON
+
+ces definistions se trouvent dans le corps du module _tkinter.c dans
+la version standard ; il faut les exporter (dans le header) et definir
+les variables associes comme extern;
+
+le _tkinter.h doit ressembler à ceci :
+
+<<
+#ifndef _TKINTER_H
+#define _TKINTER_H
+
+#ifdef WITH_THREAD
+
+#include "pythread.h"
+
+/* also included in body _tkinter.c but necessary for client using this header
+ dp 062004 */
+#ifndef TCL_THREADS
+#define TCL_THREADS
+#endif
+
+extern PyThread_type_lock tcl_lock ;
+
+#ifdef TCL_THREADS
+extern Tcl_ThreadDataKey state_key;
+typedef PyThreadState *ThreadSpecificData;
+#define tcl_tstate (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
+#else
+extern PyThreadState *tcl_tstate;
+#endif /* TCL_THREADS */
+
+#define ENTER_TCL \
+ { PyThreadState *tstate = PyThreadState_Get(); Py_BEGIN_ALLOW_THREADS \
+ if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
+
+#define LEAVE_TCL \
+ tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
+
+#define ENTER_OVERLAP \
+ Py_END_ALLOW_THREADS
+
+#define LEAVE_OVERLAP_TCL \
+ tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); }
+
+#define ENTER_PYTHON \
+ { PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \
+ if(tcl_lock)PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
+
+#define LEAVE_PYTHON \
+ { PyThreadState *tstate = PyEval_SaveThread(); \
+ if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
+
+#define CHECK_TCL_APPARTMENT \
+ if (((TkappObject *)self)->threaded && \
+ ((TkappObject *)self)->thread_id != Tcl_GetCurrentThread()) { \
+ PyErr_SetString(PyExc_RuntimeError, "Calling Tcl from different appartment"); \
+ return 0; \
+ }
+
+
+#else
+
+#define ENTER_TCL
+#define LEAVE_TCL
+#define ENTER_OVERLAP
+#define LEAVE_OVERLAP_TCL
+#define ENTER_PYTHON
+#define LEAVE_PYTHON
+#define CHECK_TCL_APPARTMENT
+
+#endif /* WITH_THREAD */
+
+#endif /* !_TKINTER_H */
+
+>>
+
+
+
Echanges avec Martin Loewis concerant les évolutions de Python et Tkinter
liés au wrapper python <-> ivy