Changeset 48439 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Sep 11, 2013 5:17:23 PM (11 years ago)
- Location:
- trunk/src/VBox/Devices/Network/lwip-new/vbox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/lwip-new/vbox/include/lwip-namespace.h
r48109 r48439 125 125 #define stats_init lwip_stats_init 126 126 #define sys_arch_mbox_fetch lwip_sys_arch_mbox_fetch 127 #define sys_arch_mbox_tryfetch(mbox, msg) lwip_sys_arch_mbox_fetch((mbox), (msg), 1) 127 #if 0 /* XXX: cf. lwip/sys.h which misinterprets this */ 128 #define sys_arch_mbox_tryfetch lwip_sys_arch_mbox_tryfetch 129 #endif 128 130 #define sys_arch_protect lwip_sys_arch_protect 129 131 #define sys_arch_sem_wait lwip_sys_arch_sem_wait -
trunk/src/VBox/Devices/Network/lwip-new/vbox/sys_arch.c
r47888 r48439 386 386 } 387 387 388 /** 389 * Try to get an entry from an mbox. 390 */ 391 u32_t sys_arch_mbox_tryfetch(sys_mbox_t *pvMbox, void **msg) 392 { 393 int rc; 394 struct sys_mbox *mbox = NULL; 395 if (!pvMbox || !*pvMbox) return SYS_MBOX_EMPTY; 396 mbox = (struct sys_mbox*)*pvMbox; 397 398 rc = LWIPMutexRequest((mbox)->mutex); 399 AssertRC(rc); 400 if ((mbox)->head == (mbox)->tail) 401 { 402 /* (mbox) is empty, don't wait */ 403 rc = LWIPMutexRelease((mbox)->mutex); 404 AssertRC(rc); 405 return SYS_MBOX_EMPTY; 406 } 407 if (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail) 408 { 409 rc = RTSemEventMultiSignal((mbox)->nonfull); 410 AssertRC(rc); 411 } 412 if (msg != NULL) 413 *msg = (mbox)->apvEntries[(mbox)->tail]; 414 (mbox)->tail++; 415 (mbox)->tail %= MBOX_ENTRIES_MAX; 416 rc = RTSemEventMultiSignal((mbox)->nonfull); 417 if ((mbox)->head == (mbox)->tail) 418 { 419 rc = RTSemEventMultiReset((mbox)->nonempty); 420 AssertRC(rc); 421 } 422 rc = LWIPMutexRelease((mbox)->mutex); 423 AssertRC(rc); 424 return 0; 425 } 426 388 427 /** Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid */ 389 428 int sys_mbox_valid(sys_mbox_t *pvMbox)
Note:
See TracChangeset
for help on using the changeset viewer.