~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Modules/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
}
223
223
 
224
224
 
225
 
/* Wait until threading._shutdown completes, provided
226
 
   the threading module was imported in the first place.
227
 
   The shutdown routine will wait until all non-daemon
228
 
   "threading" threads have completed. */
229
 
#include "abstract.h"
230
 
static void
231
 
WaitForThreadShutdown(void)
232
 
{
233
 
#ifdef WITH_THREAD
234
 
        PyObject *result;
235
 
        PyThreadState *tstate = PyThreadState_GET();
236
 
        PyObject *threading = PyMapping_GetItemString(tstate->interp->modules,
237
 
                                                      "threading");
238
 
        if (threading == NULL) {
239
 
                /* threading not imported */
240
 
                PyErr_Clear();
241
 
                return;
242
 
        }
243
 
        result = PyObject_CallMethod(threading, "_shutdown", "");
244
 
        if (result == NULL)
245
 
                PyErr_WriteUnraisable(threading);
246
 
        else
247
 
                Py_DECREF(result);
248
 
        Py_DECREF(threading);
249
 
#endif
250
 
}
251
 
 
252
225
/* Main program */
253
226
 
254
227
int
620
593
                sts = PyRun_AnyFileFlags(stdin, "<stdin>", &cf) != 0;
621
594
        }
622
595
 
623
 
        WaitForThreadShutdown();
624
 
 
625
596
        Py_Finalize();
626
597
#ifdef RISCOS
627
598
        if (Py_RISCOSWimpFlag)