[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7462 - in grc/trunk: notes src
From: |
jblum |
Subject: |
[Commit-gnuradio] r7462 - in grc/trunk: notes src |
Date: |
Fri, 18 Jan 2008 12:00:10 -0700 (MST) |
Author: jblum
Date: 2008-01-18 12:00:10 -0700 (Fri, 18 Jan 2008)
New Revision: 7462
Modified:
grc/trunk/notes/todo.txt
grc/trunk/src/ActionHandler.py
Log:
possible race condition problem resolved
Modified: grc/trunk/notes/todo.txt
===================================================================
--- grc/trunk/notes/todo.txt 2008-01-18 00:31:06 UTC (rev 7461)
+++ grc/trunk/notes/todo.txt 2008-01-18 19:00:10 UTC (rev 7462)
@@ -1,3 +1,9 @@
+############ Arbitration of Data Types: #############
+Variable bus widths with upper and lower to handle
+ floats, vectored floats
+ integers, vectored integers
+ fixed point numbers, and vectored
+
############ Blocks to Add: ####################
-ofdm (blks2)
-cpm (blks2)
Modified: grc/trunk/src/ActionHandler.py
===================================================================
--- grc/trunk/src/ActionHandler.py 2008-01-18 00:31:06 UTC (rev 7461)
+++ grc/trunk/src/ActionHandler.py 2008-01-18 19:00:10 UTC (rev 7462)
@@ -315,11 +315,9 @@
if self.get_page().get_saved() and
self.get_page().get_file_path():
ExecFlowGraphThread(self) #only
exec if file path and saved
elif state == FLOW_GRAPH_STOP:
- MUTEX.lock()
if self.get_page().get_pid_file():
try:
os.kill(int(open(self.get_page().get_pid_file(), 'r').read()), 9)
except: print "could not kill pid file:
%s"%self.get_page().get_pid_file()
- MUTEX.unlock()
elif state == '': #pass and run the global actions
pass
else: print '!!! State "%s" not handled !!!'%state
@@ -327,14 +325,21 @@
# Global Actions for all States
##############################################################################################
#set the exec button if the flow graph is valid and is not
already running
+ self.update_exec_stop()
+ #saved status
+ get_action_from_name(FLOW_GRAPH_SAVE).set_sensitive(not
self.get_page().get_saved())
+ self.main_window.update()
+
+ def update_exec_stop(self):
+ """
+ Update the exec and stop buttons.
+ Lock and unlock the mutex for race conditions with exec flow
graph threads.
+ """
MUTEX.lock()
get_action_from_name(FLOW_GRAPH_EXEC).set_sensitive(self.get_flow_graph().is_valid()
and not self.get_page().get_pid_file())
get_action_from_name(FLOW_GRAPH_STOP).set_sensitive(self.get_page().get_pid_file()
!= '')
MUTEX.unlock()
- #saved status
- get_action_from_name(FLOW_GRAPH_SAVE).set_sensitive(not
self.get_page().get_saved())
- self.main_window.update()
-
+
class ExecFlowGraphThread(Thread):
"""Execute the flow graph as a new process and wait on it to finish."""
def __init__ (self, action_handler):
@@ -343,7 +348,7 @@
@param action_handler an instance of an ActionHandler
"""
Thread.__init__(self)
- self.handle_states = action_handler.handle_states
+ self.update_exec_stop = action_handler.update_exec_stop
self.flow_graph = action_handler.get_flow_graph()
#store page and dont use main window calls in run
self.page = action_handler.get_page()
@@ -354,8 +359,7 @@
self.report_file = '/tmp/grc-%d-%d.report'%(os.getpid(),
rand_id)
self.pid_file = '/tmp/grc-%d-%d.pid'%(os.getpid(), rand_id)
self.page.set_pid_file(self.pid_file)
- get_action_from_name(FLOW_GRAPH_EXEC).set_sensitive(False)
- get_action_from_name(FLOW_GRAPH_STOP).set_sensitive(True)
+ self.update_exec_stop()
Messages.send_start_exec(self.page.get_file_path())
self.start()
@@ -377,8 +381,6 @@
except IOError: print "could not read report file:
%s"%self.report_file
try: os.remove(self.pid_file)
except: print "could not remove pid file: %s"%self.pid_file
- MUTEX.lock()
self.page.set_pid_file('')
- MUTEX.unlock()
- self.handle_states()
+ self.update_exec_stop()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7462 - in grc/trunk: notes src,
jblum <=