Felix and QtJambi: QApplication.exec() locks the main thread

View: New views
8 Messages — Rating Filter:   Alert me  

Felix and QtJambi: QApplication.exec() locks the main thread

by Piotr Korzuszek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm trying to make Qt and Felix work together. The problem is that when I
run the Qt main loop (QApplication.exec()) the main thread is locked until
the GUI is closed (so Felix is too).

I cannot put this in seperate thread because it complains to me about not
being in the main thread. On the Qt forum developers motivates this behavior
by Mac OS X GUI system that must be handled in the main thread.
Any ideas how to solve this?

--
Pozdrawiam
Piotr Korzuszek

piotr.korzuszek@...

Re: Felix and QtJambi: QApplication.exec() locks the main thread

by clement escoffier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 09.10.2009, at 19:54, Piotr Korzuszek wrote:

> Hello,
>
> I'm trying to make Qt and Felix work together. The problem is that  
> when I
> run the Qt main loop (QApplication.exec()) the main thread is locked  
> until
> the GUI is closed (so Felix is too).
>
> I cannot put this in seperate thread because it complains to me  
> about not
> being in the main thread. On the Qt forum developers motivates this  
> behavior
> by Mac OS X GUI system that must be handled in the main thread.
> Any ideas how to solve this?

Hi,

QTBambi has to be initialized in the main thread. So, the init method  
has to be called in the Main thread ( the thread executing the main  
method).

However, on Mac, you must set the -XstartOnFirstThread to execute the  
main method in the Main thread.

Regards,

Clement


>
> --
> Pozdrawiam
> Piotr Korzuszek
>
> piotr.korzuszek@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Felix and QtJambi: QApplication.exec() locks the main thread

by Piotr Korzuszek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Clement, thanks for reply,

Sorry, but I knew that already. The thing is that when I put
QApplication.init() and QApplication.exec() in bundle start() method then I
cannot do anything in Felix console after running that bundle, because
start() cannot return.

I've tried to run QApplication.init() in Main thread and QApplication.exec()
in other thread but this only results in this:
---
QApplication::exec: Must be called from the main thread
---

Or maybe I misunderstood you?


On Fri, Oct 9, 2009 at 8:23 PM, Clement Escoffier <
clement.escoffier@...> wrote:

>
> On 09.10.2009, at 19:54, Piotr Korzuszek wrote:
>
>  Hello,
>>
>> I'm trying to make Qt and Felix work together. The problem is that when I
>> run the Qt main loop (QApplication.exec()) the main thread is locked until
>> the GUI is closed (so Felix is too).
>>
>> I cannot put this in seperate thread because it complains to me about not
>> being in the main thread. On the Qt forum developers motivates this
>> behavior
>> by Mac OS X GUI system that must be handled in the main thread.
>> Any ideas how to solve this?
>>
>
> Hi,
>
> QTBambi has to be initialized in the main thread. So, the init method has
> to be called in the Main thread ( the thread executing the main method).
>
> However, on Mac, you must set the -XstartOnFirstThread to execute the main
> method in the Main thread.
>
> Regards,
>
> Clement
>
>
>
>> --
>> Pozdrawiam
>> Piotr Korzuszek
>>
>> piotr.korzuszek@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


--
Pozdrawiam
Piotr Korzuszek

piotr.korzuszek@...

Re: Felix and QtJambi: QApplication.exec() locks the main thread

by clement escoffier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 09.10.2009, at 21:29, Piotr Korzuszek wrote:

> Hi Clement, thanks for reply,
>
> Sorry, but I knew that already. The thing is that when I put
> QApplication.init() and QApplication.exec() in bundle start() method  
> then I
> cannot do anything in Felix console after running that bundle, because
> start() cannot return.
>
> I've tried to run QApplication.init() in Main thread and  
> QApplication.exec()
> in other thread but this only results in this:
> ---
> QApplication::exec: Must be called from the main thread
> ---
>
> Or maybe I misunderstood you?

No, Felix does not start bundle in the main thread (it is absolutely  
not required). So, it will not work if you try to call such method in  
the start method of a bundle. It has to be in the main thread : i.e.  
initialized externally.

Regards,

Clement


>
>
> On Fri, Oct 9, 2009 at 8:23 PM, Clement Escoffier <
> clement.escoffier@...> wrote:
>
>>
>> On 09.10.2009, at 19:54, Piotr Korzuszek wrote:
>>
>> Hello,
>>>
>>> I'm trying to make Qt and Felix work together. The problem is that  
>>> when I
>>> run the Qt main loop (QApplication.exec()) the main thread is  
>>> locked until
>>> the GUI is closed (so Felix is too).
>>>
>>> I cannot put this in seperate thread because it complains to me  
>>> about not
>>> being in the main thread. On the Qt forum developers motivates this
>>> behavior
>>> by Mac OS X GUI system that must be handled in the main thread.
>>> Any ideas how to solve this?
>>>
>>
>> Hi,
>>
>> QTBambi has to be initialized in the main thread. So, the init  
>> method has
>> to be called in the Main thread ( the thread executing the main  
>> method).
>>
>> However, on Mac, you must set the -XstartOnFirstThread to execute  
>> the main
>> method in the Main thread.
>>
>> Regards,
>>
>> Clement
>>
>>
>>
>>> --
>>> Pozdrawiam
>>> Piotr Korzuszek
>>>
>>> piotr.korzuszek@...
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> --
> Pozdrawiam
> Piotr Korzuszek
>
> piotr.korzuszek@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Felix and QtJambi: QApplication.exec() locks the main thread

by Piotr Korzuszek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Are you sure? Because I'm just running Qt in start() without any error.

Anyway I have an idea: to use this
http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.htmlto
run Qt init before Felix and then load other bundles, but I don't know
how to make them to access Qt classes yet :-), neither if this is really a
good idea.

On Fri, Oct 9, 2009 at 9:39 PM, Clement Escoffier <
clement.escoffier@...> wrote:

>
> On 09.10.2009, at 21:29, Piotr Korzuszek wrote:
>
>  Hi Clement, thanks for reply,
>>
>> Sorry, but I knew that already. The thing is that when I put
>> QApplication.init() and QApplication.exec() in bundle start() method then
>> I
>> cannot do anything in Felix console after running that bundle, because
>> start() cannot return.
>>
>> I've tried to run QApplication.init() in Main thread and
>> QApplication.exec()
>> in other thread but this only results in this:
>> ---
>> QApplication::exec: Must be called from the main thread
>> ---
>>
>> Or maybe I misunderstood you?
>>
>
> No, Felix does not start bundle in the main thread (it is absolutely not
> required). So, it will not work if you try to call such method in the start
> method of a bundle. It has to be in the main thread : i.e. initialized
> externally.
>
> Regards,
>
> Clement
>
>
>
>
>>
>> On Fri, Oct 9, 2009 at 8:23 PM, Clement Escoffier <
>> clement.escoffier@...> wrote:
>>
>>
>>> On 09.10.2009, at 19:54, Piotr Korzuszek wrote:
>>>
>>> Hello,
>>>
>>>>
>>>> I'm trying to make Qt and Felix work together. The problem is that when
>>>> I
>>>> run the Qt main loop (QApplication.exec()) the main thread is locked
>>>> until
>>>> the GUI is closed (so Felix is too).
>>>>
>>>> I cannot put this in seperate thread because it complains to me about
>>>> not
>>>> being in the main thread. On the Qt forum developers motivates this
>>>> behavior
>>>> by Mac OS X GUI system that must be handled in the main thread.
>>>> Any ideas how to solve this?
>>>>
>>>>
>>> Hi,
>>>
>>> QTBambi has to be initialized in the main thread. So, the init method has
>>> to be called in the Main thread ( the thread executing the main method).
>>>
>>> However, on Mac, you must set the -XstartOnFirstThread to execute the
>>> main
>>> method in the Main thread.
>>>
>>> Regards,
>>>
>>> Clement
>>>
>>>
>>>
>>>  --
>>>> Pozdrawiam
>>>> Piotr Korzuszek
>>>>
>>>> piotr.korzuszek@...
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>
>>
>> --
>> Pozdrawiam
>> Piotr Korzuszek
>>
>> piotr.korzuszek@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


--
Pozdrawiam
Piotr Korzuszek

piotr.korzuszek@...

Re: Felix and QtJambi: QApplication.exec() locks the main thread

by clement escoffier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 09.10.2009, at 21:54, Piotr Korzuszek wrote:

> Are you sure? Because I'm just running Qt in start() without any  
> error.

Well, it might be fuzzy and the event dispatcher (GUI Thread for  
Jambi) needs to be the main thread. I did that for Windows without a  
lot of issues, but on Mac it was terrible...

>
> Anyway I have an idea: to use this
> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.htmlto
> run Qt init before Felix and then load other bundles, but I don't know
> how to make them to access Qt classes yet :-), neither if this is  
> really a
> good idea.

That's what I did. Initializing QT. Starting Felix, Provisioning all  
the bundles, and calling exec.

Regards,

Clement


>
> On Fri, Oct 9, 2009 at 9:39 PM, Clement Escoffier <
> clement.escoffier@...> wrote:
>
>>
>> On 09.10.2009, at 21:29, Piotr Korzuszek wrote:
>>
>> Hi Clement, thanks for reply,
>>>
>>> Sorry, but I knew that already. The thing is that when I put
>>> QApplication.init() and QApplication.exec() in bundle start()  
>>> method then
>>> I
>>> cannot do anything in Felix console after running that bundle,  
>>> because
>>> start() cannot return.
>>>
>>> I've tried to run QApplication.init() in Main thread and
>>> QApplication.exec()
>>> in other thread but this only results in this:
>>> ---
>>> QApplication::exec: Must be called from the main thread
>>> ---
>>>
>>> Or maybe I misunderstood you?
>>>
>>
>> No, Felix does not start bundle in the main thread (it is  
>> absolutely not
>> required). So, it will not work if you try to call such method in  
>> the start
>> method of a bundle. It has to be in the main thread : i.e.  
>> initialized
>> externally.
>>
>> Regards,
>>
>> Clement
>>
>>
>>
>>
>>>
>>> On Fri, Oct 9, 2009 at 8:23 PM, Clement Escoffier <
>>> clement.escoffier@...> wrote:
>>>
>>>
>>>> On 09.10.2009, at 19:54, Piotr Korzuszek wrote:
>>>>
>>>> Hello,
>>>>
>>>>>
>>>>> I'm trying to make Qt and Felix work together. The problem is  
>>>>> that when
>>>>> I
>>>>> run the Qt main loop (QApplication.exec()) the main thread is  
>>>>> locked
>>>>> until
>>>>> the GUI is closed (so Felix is too).
>>>>>
>>>>> I cannot put this in seperate thread because it complains to me  
>>>>> about
>>>>> not
>>>>> being in the main thread. On the Qt forum developers motivates  
>>>>> this
>>>>> behavior
>>>>> by Mac OS X GUI system that must be handled in the main thread.
>>>>> Any ideas how to solve this?
>>>>>
>>>>>
>>>> Hi,
>>>>
>>>> QTBambi has to be initialized in the main thread. So, the init  
>>>> method has
>>>> to be called in the Main thread ( the thread executing the main  
>>>> method).
>>>>
>>>> However, on Mac, you must set the -XstartOnFirstThread to execute  
>>>> the
>>>> main
>>>> method in the Main thread.
>>>>
>>>> Regards,
>>>>
>>>> Clement
>>>>
>>>>
>>>>
>>>> --
>>>>> Pozdrawiam
>>>>> Piotr Korzuszek
>>>>>
>>>>> piotr.korzuszek@...
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>> For additional commands, e-mail: users-help@...
>>>>
>>>>
>>>>
>>>
>>> --
>>> Pozdrawiam
>>> Piotr Korzuszek
>>>
>>> piotr.korzuszek@...
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> --
> Pozdrawiam
> Piotr Korzuszek
>
> piotr.korzuszek@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Felix and QtJambi: QApplication.exec() locks the main thread

by Piotr Korzuszek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Looks like running Qt before Felix and Felix in separate thread works good
enough :-)

Thanks for your help!

On Fri, Oct 9, 2009 at 10:22 PM, Clement Escoffier <
clement.escoffier@...> wrote:

>
> On 09.10.2009, at 21:54, Piotr Korzuszek wrote:
>
>  Are you sure? Because I'm just running Qt in start() without any error.
>>
>
> Well, it might be fuzzy and the event dispatcher (GUI Thread for Jambi)
> needs to be the main thread. I did that for Windows without a lot of issues,
> but on Mac it was terrible...
>
>
>> Anyway I have an idea: to use this
>>
>> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.htmlto
>> run Qt init before Felix and then load other bundles, but I don't know
>> how to make them to access Qt classes yet :-), neither if this is really a
>> good idea.
>>
>
> That's what I did. Initializing QT. Starting Felix, Provisioning all the
> bundles, and calling exec.
>
>
> Regards,
>
> Clement
>
>
>
>> On Fri, Oct 9, 2009 at 9:39 PM, Clement Escoffier <
>> clement.escoffier@...> wrote:
>>
>>
>>> On 09.10.2009, at 21:29, Piotr Korzuszek wrote:
>>>
>>> Hi Clement, thanks for reply,
>>>
>>>>
>>>> Sorry, but I knew that already. The thing is that when I put
>>>> QApplication.init() and QApplication.exec() in bundle start() method
>>>> then
>>>> I
>>>> cannot do anything in Felix console after running that bundle, because
>>>> start() cannot return.
>>>>
>>>> I've tried to run QApplication.init() in Main thread and
>>>> QApplication.exec()
>>>> in other thread but this only results in this:
>>>> ---
>>>> QApplication::exec: Must be called from the main thread
>>>> ---
>>>>
>>>> Or maybe I misunderstood you?
>>>>
>>>>
>>> No, Felix does not start bundle in the main thread (it is absolutely not
>>> required). So, it will not work if you try to call such method in the
>>> start
>>> method of a bundle. It has to be in the main thread : i.e. initialized
>>> externally.
>>>
>>> Regards,
>>>
>>> Clement
>>>
>>>
>>>
>>>
>>>
>>>> On Fri, Oct 9, 2009 at 8:23 PM, Clement Escoffier <
>>>> clement.escoffier@...> wrote:
>>>>
>>>>
>>>>  On 09.10.2009, at 19:54, Piotr Korzuszek wrote:
>>>>>
>>>>> Hello,
>>>>>
>>>>>
>>>>>> I'm trying to make Qt and Felix work together. The problem is that
>>>>>> when
>>>>>> I
>>>>>> run the Qt main loop (QApplication.exec()) the main thread is locked
>>>>>> until
>>>>>> the GUI is closed (so Felix is too).
>>>>>>
>>>>>> I cannot put this in seperate thread because it complains to me about
>>>>>> not
>>>>>> being in the main thread. On the Qt forum developers motivates this
>>>>>> behavior
>>>>>> by Mac OS X GUI system that must be handled in the main thread.
>>>>>> Any ideas how to solve this?
>>>>>>
>>>>>>
>>>>>>  Hi,
>>>>>
>>>>> QTBambi has to be initialized in the main thread. So, the init method
>>>>> has
>>>>> to be called in the Main thread ( the thread executing the main
>>>>> method).
>>>>>
>>>>> However, on Mac, you must set the -XstartOnFirstThread to execute the
>>>>> main
>>>>> method in the Main thread.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Clement
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>> Pozdrawiam
>>>>>> Piotr Korzuszek
>>>>>>
>>>>>> piotr.korzuszek@...
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>>> For additional commands, e-mail: users-help@...
>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Pozdrawiam
>>>> Piotr Korzuszek
>>>>
>>>> piotr.korzuszek@...
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@...
>>> For additional commands, e-mail: users-help@...
>>>
>>>
>>>
>>
>> --
>> Pozdrawiam
>> Piotr Korzuszek
>>
>> piotr.korzuszek@...
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


--
Pozdrawiam
Piotr Korzuszek

piotr.korzuszek@...

Re: Felix and QtJambi: QApplication.exec() locks the main thread

by clement escoffier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 10.10.2009, at 19:42, Piotr Korzuszek wrote:

> Looks like running Qt before Felix and Felix in separate thread  
> works good
> enough :-)

Yep,

the only requirement, is to call exec in the main thread. Everything  
else is allowed (of course).

Regards,

Clement

>
> Thanks for your help!
>
> On Fri, Oct 9, 2009 at 10:22 PM, Clement Escoffier <
> clement.escoffier@...> wrote:
>
>>
>> On 09.10.2009, at 21:54, Piotr Korzuszek wrote:
>>
>> Are you sure? Because I'm just running Qt in start() without any  
>> error.
>>>
>>
>> Well, it might be fuzzy and the event dispatcher (GUI Thread for  
>> Jambi)
>> needs to be the main thread. I did that for Windows without a lot  
>> of issues,
>> but on Mac it was terrible...
>>
>>
>>> Anyway I have an idea: to use this
>>>
>>> http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.htmlto
>>> run Qt init before Felix and then load other bundles, but I don't  
>>> know
>>> how to make them to access Qt classes yet :-), neither if this is  
>>> really a
>>> good idea.
>>>
>>
>> That's what I did. Initializing QT. Starting Felix, Provisioning  
>> all the
>> bundles, and calling exec.
>>
>>
>> Regards,
>>
>> Clement
>>
>>
>>
>>> On Fri, Oct 9, 2009 at 9:39 PM, Clement Escoffier <
>>> clement.escoffier@...> wrote:
>>>
>>>
>>>> On 09.10.2009, at 21:29, Piotr Korzuszek wrote:
>>>>
>>>> Hi Clement, thanks for reply,
>>>>
>>>>>
>>>>> Sorry, but I knew that already. The thing is that when I put
>>>>> QApplication.init() and QApplication.exec() in bundle start()  
>>>>> method
>>>>> then
>>>>> I
>>>>> cannot do anything in Felix console after running that bundle,  
>>>>> because
>>>>> start() cannot return.
>>>>>
>>>>> I've tried to run QApplication.init() in Main thread and
>>>>> QApplication.exec()
>>>>> in other thread but this only results in this:
>>>>> ---
>>>>> QApplication::exec: Must be called from the main thread
>>>>> ---
>>>>>
>>>>> Or maybe I misunderstood you?
>>>>>
>>>>>
>>>> No, Felix does not start bundle in the main thread (it is  
>>>> absolutely not
>>>> required). So, it will not work if you try to call such method in  
>>>> the
>>>> start
>>>> method of a bundle. It has to be in the main thread : i.e.  
>>>> initialized
>>>> externally.
>>>>
>>>> Regards,
>>>>
>>>> Clement
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> On Fri, Oct 9, 2009 at 8:23 PM, Clement Escoffier <
>>>>> clement.escoffier@...> wrote:
>>>>>
>>>>>
>>>>> On 09.10.2009, at 19:54, Piotr Korzuszek wrote:
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>>
>>>>>>> I'm trying to make Qt and Felix work together. The problem is  
>>>>>>> that
>>>>>>> when
>>>>>>> I
>>>>>>> run the Qt main loop (QApplication.exec()) the main thread is  
>>>>>>> locked
>>>>>>> until
>>>>>>> the GUI is closed (so Felix is too).
>>>>>>>
>>>>>>> I cannot put this in seperate thread because it complains to  
>>>>>>> me about
>>>>>>> not
>>>>>>> being in the main thread. On the Qt forum developers motivates  
>>>>>>> this
>>>>>>> behavior
>>>>>>> by Mac OS X GUI system that must be handled in the main thread.
>>>>>>> Any ideas how to solve this?
>>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>
>>>>>> QTBambi has to be initialized in the main thread. So, the init  
>>>>>> method
>>>>>> has
>>>>>> to be called in the Main thread ( the thread executing the main
>>>>>> method).
>>>>>>
>>>>>> However, on Mac, you must set the -XstartOnFirstThread to  
>>>>>> execute the
>>>>>> main
>>>>>> method in the Main thread.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Clement
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>>> Pozdrawiam
>>>>>>> Piotr Korzuszek
>>>>>>>
>>>>>>> piotr.korzuszek@...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>>>> For additional commands, e-mail: users-help@...
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> Pozdrawiam
>>>>> Piotr Korzuszek
>>>>>
>>>>> piotr.korzuszek@...
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@...
>>>> For additional commands, e-mail: users-help@...
>>>>
>>>>
>>>>
>>>
>>> --
>>> Pozdrawiam
>>> Piotr Korzuszek
>>>
>>> piotr.korzuszek@...
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> --
> Pozdrawiam
> Piotr Korzuszek
>
> piotr.korzuszek@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...