Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Python/thread_wince.h

    r2 r391  
    2525long PyThread_start_new_thread(void (*func)(void *), void *arg)
    2626{
    27         long rv;
    28         int success = -1;
     27    long rv;
     28    int success = -1;
    2929
    30         dprintf(("%ld: PyThread_start_new_thread called\n", PyThread_get_thread_ident()));
    31         if (!initialized)
    32                 PyThread_init_thread();
     30    dprintf(("%ld: PyThread_start_new_thread called\n", PyThread_get_thread_ident()));
     31    if (!initialized)
     32        PyThread_init_thread();
    3333
    34         rv = _beginthread(func, 0, arg); /* use default stack size */
    35  
    36         if (rv != -1) {
    37                 success = 0;
    38                 dprintf(("%ld: PyThread_start_new_thread succeeded:\n", PyThread_get_thread_ident()));
    39         }
     34    rv = _beginthread(func, 0, arg); /* use default stack size */
    4035
    41         return success;
     36    if (rv != -1) {
     37        success = 0;
     38        dprintf(("%ld: PyThread_start_new_thread succeeded:\n", PyThread_get_thread_ident()));
     39    }
     40
     41    return success;
    4242}
    4343
     
    4848long PyThread_get_thread_ident(void)
    4949{
    50         if (!initialized)
    51                 PyThread_init_thread();
    52        
    53         return GetCurrentThreadId();
    54 }
     50    if (!initialized)
     51        PyThread_init_thread();
    5552
    56 static void do_PyThread_exit_thread(int no_cleanup)
    57 {
    58         dprintf(("%ld: do_PyThread_exit_thread called\n", PyThread_get_thread_ident()));
    59         if (!initialized)
    60                 if (no_cleanup)
    61                         exit(0); /* XXX - was _exit()!! */
    62                 else
    63                         exit(0);
    64         _endthread();
     53    return GetCurrentThreadId();
    6554}
    6655
    6756void PyThread_exit_thread(void)
    6857{
    69         do_PyThread_exit_thread(0);
     58    dprintf(("%ld: PyThread_exit_thread called\n", PyThread_get_thread_ident()));
     59    if (!initialized)
     60        exit(0);
     61    _endthread();
    7062}
    71 
    72 void PyThread__exit_thread(void)
    73 {
    74         do_PyThread_exit_thread(1);
    75 }
    76 
    77 #ifndef NO_EXIT_PROG
    78 static void do_PyThread_exit_prog(int status, int no_cleanup)
    79 {
    80         dprintf(("PyThread_exit_prog(%d) called\n", status));
    81         if (!initialized)
    82                 if (no_cleanup)
    83                         _exit(status);
    84                 else
    85                         exit(status);
    86 }
    87 
    88 void PyThread_exit_prog(int status)
    89 {
    90         do_PyThread_exit_prog(status, 0);
    91 }
    92 
    93 void PyThread__exit_prog(int status)
    94 {
    95         do_PyThread_exit_prog(status, 1);
    96 }
    97 #endif /* NO_EXIT_PROG */
    9863
    9964/*
     
    10873    dprintf(("PyThread_allocate_lock called\n"));
    10974    if (!initialized)
    110         PyThread_init_thread();
     75    PyThread_init_thread();
    11176
    11277    aLock = CreateEvent(NULL,           /* Security attributes      */
    113                         0,              /* Manual-Reset               */
    114                                                 1,              /* Is initially signalled  */
    115                         NULL);          /* Name of event            */
     78            0,              /* Manual-Reset               */
     79                        1,              /* Is initially signalled  */
     80            NULL);          /* Name of event            */
    11681
    11782    dprintf(("%ld: PyThread_allocate_lock() -> %p\n", PyThread_get_thread_ident(), aLock));
     
    143108    waitResult = WaitForSingleObject(aLock, (waitflag ? INFINITE : 0));
    144109#else
    145         /* To aid in debugging, we regularly wake up.  This allows us to
    146         break into the debugger */
    147         while (TRUE) {
    148                 waitResult = WaitForSingleObject(aLock, waitflag ? 3000 : 0);
    149                 if (waitflag==0 || (waitflag && waitResult == WAIT_OBJECT_0))
    150                         break;
    151         }
     110    /* To aid in debugging, we regularly wake up.  This allows us to
     111    break into the debugger */
     112    while (TRUE) {
     113        waitResult = WaitForSingleObject(aLock, waitflag ? 3000 : 0);
     114        if (waitflag==0 || (waitflag && waitResult == WAIT_OBJECT_0))
     115            break;
     116    }
    152117#endif
    153118
    154119    if (waitResult != WAIT_OBJECT_0) {
    155                 success = 0;    /* We failed */
     120                success = 0;    /* We failed */
    156121    }
    157122
    158         dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n", PyThread_get_thread_ident(),aLock, waitflag, success));
     123    dprintf(("%ld: PyThread_acquire_lock(%p, %d) -> %d\n", PyThread_get_thread_ident(),aLock, waitflag, success));
    159124
    160         return success;
     125    return success;
    161126}
    162127
     
    166131
    167132    if (!SetEvent(aLock))
    168         dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError()));
     133    dprintf(("%ld: Could not PyThread_release_lock(%p) error: %l\n", PyThread_get_thread_ident(), aLock, GetLastError()));
    169134}
    170135
Note: See TracChangeset for help on using the changeset viewer.