[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    Re: [Kde-perl] QThread anyone?
From:       Ashley Winters <jahqueel () yahoo ! com>
Date:       2003-05-11 20:08:30
[Download RAW message or body]


--- Germain Garand <germain@ebooksfrance.org> wrote:
> Le Lundi 05 Mai 2003 05:54, Ringwraith a écrit :
> > Hey guys... I have a "dumb" question, but I am learning.. Is there
> > anyway I can use QThread? when i call a new instance of it it says
> no
> > method call for Qt::Thread. And if there is a way would i have to
> have a
> > perl interpreter with threads support?
> >
> 
> Hi,
> The only practical way you could use threads with PerlQt would be
> through 
> ithreads (so, yes, you'd need to have those built in your
> interpreter, as 
> well as a thread-enabled Qt) and passing messages (e.g
> Qt::CustomEvents )to 
> Qt::Application::postEvent
> 
> That's not possible now though, since PerlQt isn't thread safe at
> all.
> I'll dig into that for the next release, it looks interesting. 

Ugh. Yes, PerlQt is not thread-safe. In order to acheive thread-safety,
we can't keep any Perl SV* type variables in a global C variable.

When a Perl thread is spawned, it clones all the variables into
separate interpreters, and performs draconian global interpreter
locking upon accessing anything shared between threads. Therefore, any
Perl variables PerlQt uses would have to be stored within the Perl
interpreter, and retrieved from Perl-space when used.

The better answer is: use Qt thread-safe datastructures everywhere!
Yay!

Does a QThread have to be created before the Qt datastructures start
locking themselves?

Ashley Winters

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
_______________________________________________
Kde-perl mailing list
Kde-perl@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-perl
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic