Can I use the wApp->bind() mechanism to bind a method that needs an argument?

For example, the SimpleChatServer example does NOT use wApp->bind() when it 
registers a callback:

if (server_.connect
      (this, boost::bind(&SimpleChatWidget::processChatEvent, this, _1)))

even though it uses WServer::post()

 server_.post(i->second.sessionId,
                   boost::bind(i->second.eventCallback, event));


On Nov 12, 2012, at 9:08 AM, Koen Deforche wrote:

> Hey Rob,
> 
> 2012/11/12 Rob Van Dyck <rob.van.d...@gmail.com>:
>> Hi,
>> 
>> Since the post+bind normally happens outside the wt thread, is there a way
>> to know the wApp is not yet deleted when you do the binding? For example,
>> can you ask the WServer using the sessionid?
> 
> So, yes, actually you need to bind within the event loop, and this
> function is "exported" for a call (usually later) to WServer::post()
> 
> Thus:
> 
> // Within event loop
> boost::function< void()> function =
> wApp->bind(boost::bind(WWidget::hide, text));
> std::string sessionId = wApp->sessionId();
> 
> // Later ...
> WServer::instance()->post(sessionId, function);
> 
> Regards,
> koen
> 
> PS post scriptum post datum congratulations with the expansion !
> 
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to