Author: dmeyer
Date: Mon Jan 7 16:35:38 2008
New Revision: 2951
Log:
move set_current_as_mainthread as set_mainthread to main
Modified:
trunk/base/src/__init__.py
trunk/base/src/notifier/__init__.py
trunk/base/src/notifier/main.py
trunk/base/src/notifier/nf_thread.py
trunk/base/src/notifier/thread.py
Modified: trunk/base/src/__init__.py
==============================================================================
--- trunk/base/src/__init__.py (original)
+++ trunk/base/src/__init__.py Mon Jan 7 16:35:38 2008
@@ -67,4 +67,7 @@
def select_notifier(self, *args, **kwargs):
return kaa.notifier.main.select_notifier(*args, **kwargs)
+ def __getattr__(self, attr):
+ return getattr(kaa.notifier.main, attr)
+
main = MainWrapper()
Modified: trunk/base/src/notifier/__init__.py
==============================================================================
--- trunk/base/src/notifier/__init__.py (original)
+++ trunk/base/src/notifier/__init__.py Mon Jan 7 16:35:38 2008
@@ -41,7 +41,7 @@
from popen import Process
from callback import Callback, WeakCallback, Signal, Signals
-from thread import MainThreadCallback, Thread, is_mainthread, wakeup,
set_current_as_mainthread
+from thread import MainThreadCallback, Thread, is_mainthread, wakeup
from timer import Timer, WeakTimer, OneShotTimer, WeakOneShotTimer, AtTimer,
OneShotAtTimer
from sockets import SocketDispatcher, WeakSocketDispatcher, Socket, IO_READ,
IO_WRITE
from event import Event, EventHandler, WeakEventHandler
@@ -56,7 +56,7 @@
# From sub modules
'Process',
'Callback', 'WeakCallback', 'Signal', 'Signals',
- 'MainThreadCallback', 'Thread', 'is_mainthread', 'wakeup',
'set_current_as_mainthread',
+ 'MainThreadCallback', 'Thread', 'is_mainthread', 'wakeup',
'Timer', 'WeakTimer', 'OneShotTimer', 'WeakOneShotTimer', 'AtTimer',
'OneShotAtTimer',
'SocketDispatcher', 'WeakSocketDispatcher', 'Socket', 'IO_READ',
'IO_WRITE',
'Event', 'EventHandler', 'WeakEventHandler',
Modified: trunk/base/src/notifier/main.py
==============================================================================
--- trunk/base/src/notifier/main.py (original)
+++ trunk/base/src/notifier/main.py Mon Jan 7 16:35:38 2008
@@ -42,11 +42,11 @@
import nf_wrapper as notifier
from callback import Signal
from popen import proclist as _proclist
-from thread import MainThreadCallback, is_mainthread, wakeup,
set_current_as_mainthread
+from thread import MainThreadCallback, is_mainthread, wakeup, set_mainthread
from jobserver import killall as kill_jobserver
from decorators import execute_in_mainloop
-__all__ = [ 'init', 'start', 'stop', 'step', 'is_running' ]
+__all__ = [ 'init', 'start', 'stop', 'step', 'is_running', 'wakeup',
'set_mainthread' ]
# get logging object
log = logging.getLogger('notifier')
@@ -114,7 +114,7 @@
global _running
_running = True
- set_current_as_mainthread()
+ set_mainthread()
try:
while True:
notifier.step()
Modified: trunk/base/src/notifier/nf_thread.py
==============================================================================
--- trunk/base/src/notifier/nf_thread.py (original)
+++ trunk/base/src/notifier/nf_thread.py Mon Jan 7 16:35:38 2008
@@ -149,7 +149,7 @@
raise RuntimeError('unknown notifier module %s', module)
nf_wrapper.init( 'generic', force_internal=True, **options )
# set main thread and init thread pipe
- kaa.set_current_as_mainthread()
+ kaa.main.set_mainthread()
# adding a timer or socket is not thread safe in general but
# an additional wakeup we don't need does not hurt. And in
# simulation mode the step function does not modify the
Modified: trunk/base/src/notifier/thread.py
==============================================================================
--- trunk/base/src/notifier/thread.py (original)
+++ trunk/base/src/notifier/thread.py Mon Jan 7 16:35:38 2008
@@ -46,8 +46,7 @@
#
# -----------------------------------------------------------------------------
-__all__ = [ 'MainThreadCallback', 'Thread', 'is_mainthread', 'wakeup',
- 'set_current_as_mainthread' ]
+__all__ = [ 'MainThreadCallback', 'Thread', 'is_mainthread', 'wakeup',
'set_mainthread' ]
# python imports
import sys
@@ -215,14 +214,14 @@
os.write(_thread_notifier_pipe[1], "1")
-def set_current_as_mainthread():
+def set_mainthread():
global _thread_notifier_mainthread
global _thread_notifier_pipe
_thread_notifier_mainthread = threading.currentThread()
# Make sure we have a pipe between the mainloop and threads. Since loop()
- # calls set_current_as_mainthread it is safe to assume the loop is
+ # calls set_mainthread it is safe to assume the loop is
# connected correctly. If someone calls step() without loop() and
- # without set_current_as_mainthread inter-thread communication does
+ # without set_mainthread inter-thread communication does
# not work.
if not _thread_notifier_pipe:
log.info('create thread notifier pipe')
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog