VirtualBox

Ignore:
Timestamp:
Dec 9, 2013 1:49:46 PM (11 years ago)
Author:
vboxsync
Message:

DHCP/NAT and NAT are acting in the same manner: polling for events on main thread and waiting for packets on internal network on RECV thread. DHCP/Host-Only waits for packets on main thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.h

    r49832 r49842  
    3030
    3131
     32class VBoxNetLockee
     33{
     34public:
     35    virtual int  syncEnter() = 0;
     36    virtual int  syncLeave() = 0;
     37};
     38
     39
     40class VBoxNetALock
     41{
     42public:
     43    VBoxNetALock(VBoxNetLockee *a_lck):m_lck(a_lck)
     44    {
     45        if (m_lck)
     46            m_lck->syncEnter();
     47    }
     48
     49    ~VBoxNetALock()
     50    {
     51        if (m_lck)
     52            m_lck->syncLeave();
     53    }
     54
     55private:
     56    VBoxNetLockee *m_lck;
     57};
     58
    3259# ifndef BASE_SERVICES_ONLY
    33 class VBoxNetBaseService: public VBoxNetHlpUDPService
     60class VBoxNetBaseService: public VBoxNetHlpUDPService, public VBoxNetLockee
    3461{
    3562public:
     
    4875                                        void const *pvData, size_t cbData) const;
    4976    virtual void        usage(void) = 0;
    50     virtual int         run(void) = 0;
    5177    virtual int         parseOpt(int rc, const RTGETOPTUNION& getOptVal) = 0;
    5278    virtual int         processFrame(void *, size_t) = 0;
     
    5682
    5783    virtual int         init(void);
     84    virtual int         run(void);
    5885    virtual bool        isMainNeeded() const;
    5986
     
    96123    virtual void debugPrintV(int32_t iMinLevel, bool fMsg, const char *pszFmt, va_list va) const;
    97124
     125    private:
    98126    void doReceiveLoop();
    99127
    100 protected:
     128    /** starts receiving thread and enter event polling loop. */
     129    int startReceiveThreadAndEnterEventLoop();
     130
     131    protected:
    101132    /* VirtualBox instance */
    102133    ComPtr<IVirtualBox> virtualbox;
    103134
    104 private:
     135    private:
    105136    struct Data;
    106137    Data *m;
    107138
    108 private:
     139    private:
    109140    PRTGETOPTDEF getOptionsPtr();
    110141};
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette