Changeset 37
- Timestamp:
- Nov 9, 2005 3:51:49 PM (19 years ago)
- Location:
- pjproject/main/pjlib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/main/pjlib/include/pj++/pool.hpp
r36 r37 16 16 public: 17 17 void *operator new(unsigned int class_size, Pj_Pool *pool); 18 void operator delete(void*); 19 void operator delete(void*, Pj_Pool*); 18 void *operator new(unsigned int class_size, Pj_Pool &pool); 19 20 void operator delete(void*) 21 { 22 } 23 24 void operator delete(void*, Pj_Pool*) 25 { 26 } 27 28 void operator delete(void*, Pj_Pool&) 29 { 30 } 20 31 21 32 // … … 221 232 return pool->alloc(class_size); 222 233 } 223 inline void Pj_Object::operator delete(void *ptr) 224 { 225 } 226 inline void Pj_Object::operator delete(void *ptr, Pj_Pool*) 227 { 234 inline void *Pj_Object::operator new(unsigned int class_size, Pj_Pool &pool) 235 { 236 return pool.alloc(class_size); 228 237 } 229 238 -
pjproject/main/pjlib/include/pj++/proactor.hpp
r36 r37 24 24 public: 25 25 // 26 // Construct with null handler. 27 // App must call set_handler() before use. 28 // 29 Pj_Async_Op() 30 : handler_(NULL) 31 { 32 } 33 34 // 26 35 // Constructor. 27 36 // … … 30 39 { 31 40 pj_memset(this, 0, sizeof(pj_ioqueue_op_key_t)); 41 } 42 43 // 44 // Set handler. 45 // 46 void set_handler(Pj_Event_Handler *handler) 47 { 48 handler_ = handler; 32 49 } 33 50 … … 98 115 99 116 // 100 // Receive data.117 // Start async receive. 101 118 // 102 119 pj_status_t recv( Pj_Async_Op *op_key, … … 109 126 110 127 // 111 // Recvfrom()128 // Start async recvfrom() 112 129 // 113 130 pj_status_t recvfrom( Pj_Async_Op *op_key, … … 121 138 122 139 // 123 // send()140 // Start async send() 124 141 // 125 142 pj_status_t send( Pj_Async_Op *op_key, … … 131 148 132 149 // 133 // sendto()150 // Start async sendto() 134 151 // 135 152 pj_status_t sendto( Pj_Async_Op *op_key, … … 143 160 #if PJ_HAS_TCP 144 161 // 145 // connect()162 // Start async connect() 146 163 // 147 164 pj_status_t connect(const Pj_Inet_Addr &addr) … … 151 168 152 169 // 153 // accept.170 // Start async accept(). 154 171 // 155 172 pj_status_t accept( Pj_Async_Op *op_key, … … 273 290 cb_.on_accept_complete = &accept_complete_cb; 274 291 cb_.on_connect_complete = &connect_complete_cb; 292 293 create(pool, max_fd, max_timer_entries); 275 294 } 276 295 … … 305 324 } 306 325 307 status;326 return status; 308 327 } 309 328 -
pjproject/main/pjlib/src/pjlib++-test/main.cpp
r36 r37 9 9 #include <pj++/timer.hpp> 10 10 #include <pj++/tree.hpp> 11 12 class My_Async_Op : public Pj_Async_Op 13 { 14 }; 15 16 class My_Event_Handler : public Pj_Event_Handler 17 { 18 }; 11 19 12 20 int main() … … 25 33 delete plsem; 26 34 35 Pj_Proactor proactor(pool, 100, 100); 36 37 My_Event_Handler *event_handler = new(the_pool) My_Event_Handler; 38 proactor.register_socket_handler(pool, event_handler); 39 proactor.unregister_handler(event_handler); 40 27 41 return 0; 28 42 }
Note: See TracChangeset
for help on using the changeset viewer.