realbasic-nug
[Top] [All Lists]

Re: Threads

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Threads
From: Joe Strout <joe@inspiringapps.com>
Date: Thu, 31 Jul 2008 09:36:03 -0600
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <C4B7492F.14C00%James.T.Miller@JHUAPL.edu>
References: <C4B7492F.14C00%James.T.Miller@JHUAPL.edu>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Jul 31, 2008, at 8:49 AM, Miller, James T. wrote:

1- If I run multiple threads (2 or 3) on a Mac with 4 CPUs, does each thread execute on its own CPU, i.e., is there a processing boost to using threads
in this case.

No, they are cooperative threads and run on a single core (and have the benefit of not crashing if you call anything not threadsafe, such as most of the UI functions in the OS.)

2 - What happens if a thread (or several threads) calls a method that is not in the thread, e.g., a method defined in the window class that initiated the
thread?

It doesn't matter what it calls. The thread is the code in the Run event and anything that Run event calls, directly or indirectly. It doesn't matter where that code lives in your project; it's being run as a separate thread if it's being called from code that's running as a separate thread.

 In particular, are such methods re-enterant, i.e., if one thread
calls the method while the other is still using the same method, will the processing in the method execute properly for both calls (seems to in my
testing).

Yes. Of course if the method accesses anything other than local variables (such as static variables, globals, object properties, etc.), then the two instances of the method may still communicate, and your definition of "execute properly" will become important.

Best,
- Joe

--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>