File indexing completed on 2024-05-12 08:36:15
0001 #!/usr/bin/env python2.7 0002 # -*- coding: utf-8 -*- 0003 """:synopsis: Create multiple threads of control within one interpreter. 0004 0005 """ 0006 """ 0007 This is the type of lock objects. 0008 0009 0010 """ 0011 LockType = None 0012 def start_new_thread(function,args,kwargs): 0013 """ 0014 Start a new thread and return its identifier. The thread executes the function 0015 *function* with the argument list *args* (which must be a tuple). The optional 0016 *kwargs* argument specifies a dictionary of keyword arguments. When the function 0017 returns, the thread silently exits. When the function terminates with an 0018 unhandled exception, a stack trace is printed and then the thread exits (but 0019 other threads continue to run). 0020 0021 0022 """ 0023 pass 0024 0025 def interrupt_main(): 0026 """ 0027 Raise a :exc:`KeyboardInterrupt` exception in the main thread. A subthread can 0028 use this function to interrupt the main thread. 0029 0030 """ 0031 pass 0032 0033 def exit(): 0034 """ 0035 Raise the :exc:`SystemExit` exception. When not caught, this will cause the 0036 thread to exit silently. 0037 0038 .. 0039 function:: exit_prog(status) 0040 0041 Exit all threads and report the value of the integer argument 0042 *status* as the exit status of the entire program. 0043 **Caveat:** code in pending :keyword:`finally` clauses, in this thread 0044 or in other threads, is not executed. 0045 0046 0047 """ 0048 pass 0049 0050 def allocate_lock(): 0051 """ 0052 Return a new lock object. Methods of locks are described below. The lock is 0053 initially unlocked. 0054 0055 0056 """ 0057 pass 0058 0059 def get_ident(): 0060 """ 0061 Return the 'thread identifier' of the current thread. This is a nonzero 0062 integer. Its value has no direct meaning; it is intended as a magic cookie to 0063 be used e.g. to index a dictionary of thread-specific data. Thread identifiers 0064 may be recycled when a thread exits and another thread is created. 0065 0066 0067 """ 0068 pass 0069 0070 def stack_size(size): 0071 """ 0072 Return the thread stack size used when creating new threads. The optional 0073 *size* argument specifies the stack size to be used for subsequently created 0074 threads, and must be 0 (use platform or configured default) or a positive 0075 integer value of at least 32,768 (32kB). If changing the thread stack size is 0076 unsupported, the :exc:`error` exception is raised. If the specified stack size is 0077 invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32kB 0078 is currently the minimum supported stack size value to guarantee sufficient 0079 stack space for the interpreter itself. Note that some platforms may have 0080 particular restrictions on values for the stack size, such as requiring a 0081 minimum stack size > 32kB or requiring allocation in multiples of the system 0082 memory page size - platform documentation should be referred to for more 0083 information (4kB pages are common; using multiples of 4096 for the stack size is 0084 the suggested approach in the absence of more specific information). 0085 Availability: Windows, systems with POSIX threads. 0086 0087 """ 0088 pass 0089