mailRe: r11079 - /branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Edward d'Auvergne on April 14, 2010 - 09:08:
You could then just use:

id = thread.start_new_thread(self.execute_thread, ())

and remove the argument from self.execute_thread.  This should then
work.  This seems to be related to the low-level nature of the thread
class "this module provides low-level primitives for working with
multiple threads".  The word low-level is, in programming speak, a
strong warning!  I think that because the Python hard-core programming
elite recommend the following about the thread package
(http://docs.python.org/library/thread.html):

"... you should consider using the high-level threading module instead."

and:

"The threading module provides an easier to use and higher-level
threading API built on top of this module."

Not only that, but 'thread' is not supported on all computer systems
but 'threading' is - "For systems lacking the thread module, the
dummy_thread module is available.".  Therefore I would consider it
very unwise to not switch from the 'thread' module to the 'threading'
module.

Regards,

Edward



On 14 April 2010 00:33, Michael Bieri <michael.bieri@xxxxxxxxxxxxx> wrote:
The dummy_string is added as thread.start_new_thread needs two arguments. If
we call execute_thread() function as self.execute_thread(), we cannot create
a tuple, which is necessary in the second argument. Therefore, I created the
dummy_string. This allows to add a tuple as second argument. Not ideal...
but works.

Edward d'Auvergne wrote:

This is fair enough.  But what is the purpose of dummy_string?

Cheers,

Edward


On 13 April 2010 07:01,  <michael.bieri@xxxxxxxxxxxxx> wrote:


Author: michaelbieri
Date: Tue Apr 13 07:01:28 2010
New Revision: 11079

URL: http://svn.gna.org/viewcvs/relax?rev=11079&view=rev
Log:
Storage of thread id is removed from auto_rx_base.py as it is unused
(threads can't get killed).

Modified:
  branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py

Modified: branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py
URL:
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py?rev=11079&r1=11078&r2=11079&view=diff

==============================================================================
--- branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py (original)
+++ branches/bieri_gui/gui_bieri/analyses/auto_rx_base.py Tue Apr 13
07:01:28 2010
@@ -363,27 +363,14 @@
       # Display the relax controller.
       self.gui.controller.Show()

-        # FIXME:  Debugging code, non-threaded exec.
-        self.execute_thread()
-        event.Skip()
-        return
-
-        # The thread object storage.
-        self.gui.calc_threads.append(Thread_container())
-        thread_cont = self.gui.calc_threads[-1]
-
       # Start the thread.
-        id = thread.start_new_thread(self.execute_thread, ())
-
-        # Add the thread info to the container.
-        thread_cont.id = id
-        thread_cont.analysis_type = self.analysis_type
+        id = thread.start_new_thread(self.execute_thread, ('dummy',))

       # Terminate the event.
       event.Skip()


-    def execute_thread(self):
+    def execute_thread(self, dummy_string):
       """Execute the calculation in a thread."""

       # Redirect relax output and errors to the controller.


_______________________________________________
relax (http://nmr-relax.com)

This is the relax-commits mailing list
relax-commits@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits



_______________________________________________
relax (http://nmr-relax.com)

This is the relax-devel mailing list
relax-devel@xxxxxxx

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel







Related Messages


Powered by MHonArc, Updated Thu Apr 15 00:20:29 2010