realbasic-nug
[Top] [All Lists]

Re: Preemptive threading

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Preemptive threading
From: Jonathan Johnson <jon at alacatialabs dot com>
Date: Wed, 30 Jan 2008 13:15:50 -0600
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <1ibfyc3 dot 12685mu1p3mfcxM%realbasiclists at monkeybreadsoftware dot de>
On Jan 28, 2008, at 12:36 PM, Christian Schmitz wrote:

> Hi,
>
> Can someone test for me the ThreadMBS class on Windows and Linux?
>
> I'd like to know how well it does on a PC with more than 2 Cores, if
> possible.
>
> On my 8 core Mac Pro I got CPU usage up to 790% for my test  
> application.

I'm curious as to how you dealt with the fact that REALbasic is not  
thread-safe. I notice that you do have LockRuntime methods, but even  
invoking the LockRuntime methods can cause reference counts to go our  
of whack. If two threads access an object at the same time (just  
simply refer to it, store a separate copy, etc), the reference count  
will increase. If both threads do it at once, it is possible for the  
REALbasic runtime to get in a situation where the reference count was  
only incremented once, because it isn't thread-safe. This will then  
yield a crash once the object is unlocked for the final time.

Same story with all other reference counted types.

The REALbasic runtime *needs* thread-safety. Until it's thread-safe,  
the only safe methods you can write in REALbasic code are strictly  
mathematical functions in global modules that don't refer to any  
objects or strings.

-Jon


-- 
Jonathan Johnson
President
Alacatia Labs, Inc.
http://www.alacatialabs.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>