Hello Hadass,

This happens because your worker thread is not bound to a
WApplication. But even if your thread is not bound to a WApplication,
there is no good reason why you wouldn't be able to emit a Wt::Signal.
I patched Wt - this will be in our public git soon. (you won't be able
to query the sender of a signal that is emitted from an unbound
thread, but that is hardly ever used in Wt. WSignalMapper is one
place)

'Bind thread to a WApplication': see WApplication::attachThread()

Alternative solution: Instantiate a WTestEnvironment and a dummy
WApplication, and bind your worker thread to that WApplication. If you
do it this way, you will be able to query the sender of the signal, if
you'd need this feature.

Regards,
Wim.


2010/1/7 HADASS YAARI <[email protected]>:
> Hello everybody,
> I try to implement server push this way:
>  - a global instance of a class that everybody knows that contains the
> signal.
>  - thread that will emit the signal whenever necessary.
>  - some WContainerWidgets (represent different web pages) will connect to
> the signal.
>
> It sounds simple, but I have encountered a lot of problems and I want to
> consult you.
> I read that the class that contains the signal must inherit from WObject, so
> I created a class like this taht is global.
> The WContainerWidgets succeed in connecting the signal but when the thread
> emits the signal (by invoking a method of the class that contains it), the
> program collapse because of sender() method - access violation.
> If the WContainerWidgets that connects to the signal emits it, it works
> perfectly.
>
> I don't understand what happens.
> I understand that sender() returns the WObject that connected the signal -
> so why does it work when I am inside the object, and not when the thread
> calls it. Is it possible to emit signals from different threads? It sounds
> logically that it is.
>
> Thank you,
> Hadas
> ________________________________
> This message (including any attachments) issued by RAFAEL- ADVANCED DEFENSE
> SYSTEMS LTD. (hereinafter "RAFAEL") contains confidential information
> intended for a specific individual and purpose, may constitute information
> that is privileged or confidential or otherwise protected from disclosure.
> If you are not the intended recipient, you should contact us immediately and
> thereafter delete this message from your system. You are hereby notified
> that any disclosure, copying, dissemination, distribution or forwarding of
> this message, or the taking of any action based on it, is strictly
> prohibited. If you have received this e-mail in error, please notify us
> immediately by e-mail mailto:[email protected] and completely delete or
> destroy any and all electronic or other copies of the original message and
> any attachments thereof.
> ________________________________
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to