A common use of function

Source: Internet
Author: User

A common use of functionvoidShare::initacrossmanager () {gsmgrevent gsmgrevents;//structure that holds functionGsmgrevents.fnsenddata2client = [ This](intNchannelid,void* PData,intNlen)//Lambda bindings, of course, can also be bound with Std::bind{sendcmd2c (Nchannelid, s2c_prop_opt, PData, Nlen);    }; Gsmgrevents.fnsenddata2msbymapid= [ This](intNmapid,void* PData,intNlen)    {Sendcmd2msbymapid (Nmapid, Gs2ms_prop_mgr, PData, Nlen);    }; Gsmgrevents.fnsenddata2ms= [ This](intNchannelid,void* PData,intNlen)    {Sendcmd2msbychannelid (Nchannelid, Gs2ms_prop_mgr, PData, Nlen);    }; M_sppropmanager-Init (gsmgrevents);} By the time the Propmanager module can be called directly through the function in the m_cevents share functions, is a callback process, working very little contact with this, so every time it feels awkward I know the callback is two threads, When another thread completes a callback, the NGP is passed through the NGP context. I was just thinking that another module can be called through an interface or function, but sometimes it has to function, because functions can be bound to any one of the public, private, Regardless of the class, as long as a process can be, with the interface function does not matter, this is more flexible, and the module is more independent, but the function needs to be bound in advance

A common use of function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.