summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-02-26 10:20:53 (GMT)
committerGuido van Rossum <guido@python.org>1995-02-26 10:20:53 (GMT)
commite7134aa0f205fcb42a6f0b7c61446e87007c4a57 (patch)
treea6aed46ef68887266a0832cfff78f5ab31c78474 /Mac
parent83c434b145793a1ec2c31f6b2f82834457753373 (diff)
downloadcpython-e7134aa0f205fcb42a6f0b7c61446e87007c4a57.zip
cpython-e7134aa0f205fcb42a6f0b7c61446e87007c4a57.tar.gz
cpython-e7134aa0f205fcb42a6f0b7c61446e87007c4a57.tar.bz2
return old value of PyMac_DoYieldEnabled; -1 means do not even check for interrupts
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/macosmodule.c11
-rw-r--r--Mac/Python/macglue.c10
2 files changed, 15 insertions, 6 deletions
diff --git a/Mac/Modules/macosmodule.c b/Mac/Modules/macosmodule.c
index 177ddcd..c5f14d6 100644
--- a/Mac/Modules/macosmodule.c
+++ b/Mac/Modules/macosmodule.c
@@ -197,13 +197,13 @@ MacOS_SetScheduleTimes(PyObject *self, PyObject *args)
static PyObject *
MacOS_EnableAppswitch(PyObject *self, PyObject *args)
{
- int enable;
+ int old, new;
- if (!PyArg_ParseTuple(args, "i", &enable))
+ if (!PyArg_ParseTuple(args, "i", &new))
return NULL;
- PyMac_DoYieldEnabled = enable;
- Py_INCREF(Py_None);
- return Py_None;
+ old = PyMac_DoYieldEnabled;
+ PyMac_DoYieldEnabled = new;
+ return Py_BuildValue("i", old);
}
@@ -246,3 +246,4 @@ MacOS_Init()
if (MacOS_Error == NULL || PyDict_SetItemString(d, "Error", MacOS_Error) != 0)
Py_FatalError("can't define MacOS.Error");
}
+
diff --git a/Mac/Python/macglue.c b/Mac/Python/macglue.c
index 7135f33..e6767c8 100644
--- a/Mac/Python/macglue.c
+++ b/Mac/Python/macglue.c
@@ -115,7 +115,12 @@ static long yield_bg = 12;
static long lastyield;
static int in_foreground;
-int PyMac_DoYieldEnabled = 1; /* Don't do eventloop when false */
+/*
+** When > 0, do full scanning for events (program is not event aware)
+** when == 0, only scan for Command-period
+** when < 0, don't do any event scanning
+*/
+int PyMac_DoYieldEnabled = 1;
/* Convert C to Pascal string. Returns pointer to static buffer. */
unsigned char *
@@ -238,6 +243,8 @@ scan_event_queue(flush)
int
PyOS_InterruptOccurred()
{
+ if (PyMac_DoYieldEnabled < 0)
+ return 0;
#ifdef THINK_C
scan_event_queue(1);
#endif
@@ -882,3 +889,4 @@ PyMac_InitApplication()
}
Py_Main(argc, argv);
}
+