Commit Graph

45 Commits

Author SHA1 Message Date
Tim Peters 21429932e4 Thread.__delete: Discussion of internal obscurities belongs in comments
rather than in docstrings.  Rewrote so that _active_limbo_lock is released
no matter what happens (it could have been left locked if _sys got None'd
out).  Use "in" in preference to has_key() for dict lookup.  Don't bother
looking for 'dummy_threading' in sys.modules unless KeyError is raised.
Since the heart of the method is the del, do that in only one place.
2004-07-21 03:36:52 +00:00
Brett Cannon 8b3d92a977 Fix bug where a KeyError was raised if -O was being used for the interpreter
and Thread.__delete() was called after a Thread instance was created.  Problem
resulted from a currentThread() call in an 'assert' statement being optimized
out and dummy_thread.get_ident() always returning -1 and thus overwriting the
entry for the _MainThread() instance created in 'threading' at import time.

Closes bug #993394.
2004-07-21 02:21:58 +00:00
Jim Fulton d15dc06df0 Implemented thread-local data as proposed on python-dev:
http://mail.python.org/pipermail/python-dev/2004-June/045785.html
2004-07-14 19:11:50 +00:00
Brett Cannon cc4e935ea5 threading.Thread objects will now print a traceback for an exception raised
during interpreter shutdown instead of masking it with another traceback about
accessing a NoneType when trying to print the exception out in the first place.

Closes bug #754449 (using patch #954922).
2004-07-03 03:52:35 +00:00
Brett Cannon 4b6b7f1515 Remove calls to currentThread() in _Condition methods that were side-effect.
Side-effects were deemed unnecessary and were causing problems at shutdown
time when threads were catching exceptions at start time and then triggering
exceptions trying to call currentThread() after gc'ed.  Masked the initial
exception which was deemed bad.

Fixes bug #754449 .
2004-03-08 22:18:57 +00:00
Raymond Hettinger 756b3f3c15 * Move collections.deque() in from the sandbox
* Add unittests, newsitem, and whatsnew
* Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py
* Docs are forthcoming
2004-01-29 06:37:52 +00:00
Neil Schemenauer f607fc5395 Add traceback.format_exc(). 2003-11-05 23:03:00 +00:00
Tim Peters 59aba128a5 Make the classes exposed by threading.py new-style classes. This is
mostly for convenience and to aid debugging.
2003-07-01 20:01:55 +00:00
Tim Peters 0939fac795 Resolved minor XXX question in the obvious way. 2003-07-01 19:28:44 +00:00
Tim Peters d1b108b953 Whitespace normalization. 2003-06-29 17:24:17 +00:00
Jeremy Hylton 89392c0005 Remove stub settrace() and setprofile() calls. 2003-06-29 17:07:46 +00:00
Jeremy Hylton bfccb35b58 Add settrace() and setprofile() functions to the threading library. 2003-06-29 16:58:41 +00:00
Tim Peters 685e69739e Provide dummy (do-nothing) settrace() and setprofile() functions until
Jeremy can check in the real things.
2003-06-29 16:50:06 +00:00
Guido van Rossum 68468eba63 Get rid of many apply() calls. 2003-02-27 20:14:51 +00:00
Fred Drake a872595f31 - prefer "import ... as" to "import / (assignments) / del" for most things
- when the thread module isn't available, subsequent attempts to import
  threading should not suceed
2002-12-30 23:32:50 +00:00
Guido van Rossum c262a1f51c Add __all__. (Brett Cannon.) 2002-12-30 21:59:55 +00:00
Guido van Rossum 21b60147e9 The _Event class should be more careful with releasing its lock when
interrupted.  A try/finally will do nicely.  Maybe other classes need
this too, but since they manipulate more state it's less clear that
that is always the right thing, and I'm in a hurry.

Backport candidate.
2002-11-21 21:08:39 +00:00
Jeremy Hylton 92bb6e7b96 Docstring nits: The module is neither proposed nor new. 2002-08-14 19:25:42 +00:00
Jeremy Hylton 29c2106465 Explain use of currentThread() in _Condition methods. 2002-08-14 17:56:13 +00:00
Jeremy Hylton 39c12bfba1 Explain a little more. 2002-08-14 17:46:40 +00:00
Jeremy Hylton af7fde7f34 Explain a minor mystery. 2002-08-14 17:43:59 +00:00
Raymond Hettinger 46ac8eb3c8 Code modernization. Replace v=s[i]; del s[i] with single lookup v=s.pop(i) 2002-06-30 03:39:14 +00:00
Guido van Rossum 8ca162f417 Partial introduction of bools where appropriate. 2002-04-07 06:36:23 +00:00
Tim Peters bc0e910826 Convert a pile of obvious "yes/no" functions to return bool. 2002-04-04 22:55:58 +00:00
Neal Norwitz 45bec8c7fc SF #515023. Make _DummyThread.join() signature match base class (Thread) 2002-02-19 03:01:36 +00:00
Guido van Rossum f21b2aafa9 Thread.__bootstrap(): ignore exceptions in the self.__delete() call in
the finally clause.  An exception here could happen when a daemon
thread exits after the threading module has already been trashed by
the import finalization, and there's not much of a point in trying to
insist doing the cleanup in that stage.

This should fix SF bug ##497111: active_limbo_lock error at program
exit.

2.1.2 and 2.2.1 Bugfix candidate!
2001-12-28 22:07:09 +00:00
Tim Peters b64bec3ec0 Whitespace normalization. 2001-09-18 02:26:39 +00:00
Martin v. Löwis 44f8696171 Patch #428326: New class threading.Timer. 2001-09-05 13:44:54 +00:00
Skip Montanaro e428bb7030 Added new BoundedSemaphore class. Closes bug 452836. 2001-08-20 20:27:58 +00:00
Skip Montanaro ae8454aeb3 of course I muffed it separating the notes code from the initial_value
code.  grrr...
2001-08-19 05:53:47 +00:00
Skip Montanaro b446fc7f27 add debug calls to self._note for the Semaphore class. This closes bug
443614.  I will submit a new feature request and patch to threading.py and
libthreading.tex to address the bounded semaphore issue.
2001-08-19 04:25:24 +00:00
Andrew M. Kuchling a49e0a0893 Remove unused imports (PyChecker) 2001-08-13 14:40:29 +00:00
Tim Peters a6a4f27ef7 _Condition.wait(): never sleep longer than the timeout time remaining,
and even if we have a long time left to wait, try the lock at least 20
times/second.
2001-08-12 00:41:33 +00:00
Tim Peters c951bf9128 SF bug [#410708] Condition.wait() and KeyboardInterrupt.
http://sourceforge.net/tracker/?func=detail&aid=410708&group_id=5470&atid=105470
Added try/finally around Condition.wait() guts, so that the lock state gets
restored at the end no matter what happens.
2001-04-02 20:15:57 +00:00
Tim Peters b90f89a496 Whitespace normalization. 2001-01-15 03:26:36 +00:00
Guido van Rossum 5080b33046 Comment out a debugging print statement that triggered a complaint in
c.l.py.
2000-12-15 20:08:39 +00:00
Fred Drake 7b4fc17c6d Revise to use atexit instead of monkeying with sys.exitfunc directly. 2000-08-18 15:50:54 +00:00
Jeremy Hylton b5fc749c8b patch from Charles Waldman--
define ThreadError (== thread.error); docs should be updated, too
2000-06-01 01:17:17 +00:00
Andrew M. Kuchling 39d3bfc4c2 Fix a typo in a comment 2000-02-29 00:10:24 +00:00
Guido van Rossum e7b146fb3b The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:28:42 +00:00
Guido van Rossum 8e7eaa8ac8 Duncan Grisby noted a typo in _DummyThread. 1999-09-29 15:26:52 +00:00
Guido van Rossum 5a43e1a90c Get rid of tabnanny's last complaints. 1998-06-09 19:04:26 +00:00
Guido van Rossum b39e461b89 Two places where _time() should be used said time.time(), which
doesn't work of course.
1998-05-29 17:47:10 +00:00
Guido van Rossum b26a1b4e2b Use random instead of whrandom. 1998-05-20 17:05:52 +00:00
Guido van Rossum 7f5013a9a9 New Java-style threading module. The doc strings are in a separate module. 1998-04-09 22:01:42 +00:00