1 #ifndef _WDL_SHM_CONNECTION_H_
2 #define _WDL_SHM_CONNECTION_H_
7 #include "swell/swell.h"
8 #include "swell/swell-internal.h"
13 #include "wdlstring.h"
17 class WDL_SHM_Connection
20 WDL_SHM_Connection(bool whichChan
, // a true con connects to a false con -- note on SHM false should be created FIRST.
21 const char *uniquestring
, // identify
22 int shmsize
=262144, // bytes, whoever opens first decides
24 int extra_flags
=0 // on posix, set 1 for the master to create a .lock file as well
27 ~WDL_SHM_Connection();
29 int Run(); // call as often as possible, returns <0 error, >0 if did something
31 bool WantSendKeepAlive(); // called when it needs a keepalive to be sent (may be never, or whatever interval it decides)
33 // wait for this if you want to see when data comes in
37 return m_events
[m_whichChan
];
43 // receiving and sending data
57 int m_whichChan
; // which channel we read from
61 HANDLE m_file
, m_filemap
;
62 HANDLE m_events
[2]; // [m_whichChan] set when the other side did something useful
67 time_t m_next_keepalive
;
72 char *m_rdbuf
; // m_rdbufsize
80 void acquireListener();