Changeset 100566 in vbox
- Timestamp:
- Jul 13, 2023 6:50:43 PM (19 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/GuestHost/SharedClipboard.h
r100451 r100566 189 189 /** Payload to this event, optional (NULL). */ 190 190 PSHCLEVENTPAYLOAD pPayload; 191 /** Result code (IPRT-style) to assign. */ 192 int rc; 191 193 } SHCLEVENT; 192 194 /** Pointer to a shared clipboard event. */ … … 236 238 uint32_t ShClEventRetain(PSHCLEVENT pEvent); 237 239 uint32_t ShClEventRelease(PSHCLEVENT pEvent); 240 int ShClEventSignalEx(PSHCLEVENT pEvent, int rc, PSHCLEVENTPAYLOAD pPayload); 238 241 int ShClEventSignal(PSHCLEVENT pEvent, PSHCLEVENTPAYLOAD pPayload); 239 242 int ShClEventWait(PSHCLEVENT pEvent, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD *ppPayload); 243 int ShClEventWaitEx(PSHCLEVENT pEvent, RTMSINTERVAL uTimeoutMs, int *pRc, PSHCLEVENTPAYLOAD *ppPayload); 240 244 /** @} */ 241 245 -
trunk/include/VBox/err.h
r100183 r100566 3073 3073 /** Shared Clipboard transfer ID not found. */ 3074 3074 #define VERR_SHCLPB_TRANSFER_ID_NOT_FOUND (-7150) 3075 /** Shared Clipboard guest error. */ 3076 #define VERR_SHCLPB_GUEST_ERROR (-7151) 3077 /** Shared Clipboard event failed error. */ 3078 #define VERR_SHCLPB_EVENT_FAILED (-7152) 3075 3079 /** @} */ 3076 3080 -
trunk/src/VBox/GuestHost/SharedClipboard/clipboard-common.cpp
r100328 r100566 457 457 * 458 458 * @returns VBox status code. 459 * @retval VERR_SHCLPB_EVENT_FAILED if the event has a set error code. 459 460 * @param pEvent Event to wait for. 460 461 * @param uTimeoutMs Timeout (in ms) to wait. 462 * @param pRc Where to return the event rc. Optional and can be NULL. 461 463 * @param ppPayload Where to store the (allocated) event payload on success. Needs to be free'd with 462 464 * SharedClipboardPayloadFree(). Optional. 463 465 */ 464 int ShClEventWait (PSHCLEVENT pEvent, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD *ppPayload)466 int ShClEventWaitEx(PSHCLEVENT pEvent, RTMSINTERVAL uTimeoutMs, int *pRc, PSHCLEVENTPAYLOAD *ppPayload) 465 467 { 466 468 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); … … 471 473 if (RT_SUCCESS(rc)) 472 474 { 475 if (RT_FAILURE(pEvent->rc)) 476 rc = VERR_SHCLPB_EVENT_FAILED; 477 478 if (pRc) 479 *pRc = pEvent->rc; 480 473 481 if (ppPayload) 474 482 { … … 486 494 487 495 /** 496 * Waits for an event to get signalled. 497 * 498 * @returns VBox status code. 499 * @retval VERR_SHCLPB_EVENT_FAILED if the event has a set error code. 500 * @param pEvent Event to wait for. 501 * @param uTimeoutMs Timeout (in ms) to wait. 502 * @param ppPayload Where to store the (allocated) event payload on success. Needs to be free'd with 503 * SharedClipboardPayloadFree(). Optional. 504 */ 505 int ShClEventWait(PSHCLEVENT pEvent, RTMSINTERVAL uTimeoutMs, PSHCLEVENTPAYLOAD *ppPayload) 506 { 507 return ShClEventWaitEx(pEvent, uTimeoutMs, NULL /* pRc */, ppPayload); 508 } 509 510 /** 488 511 * Retains an event by increasing its reference count. 489 512 * … … 527 550 528 551 /** 552 * Signals an event, extended version. 553 * 554 * @returns VBox status code. 555 * @param pEvent Event to signal. 556 * @param rc Result code to set. 557 * @param pPayload Event payload to associate. Takes ownership on 558 * success. Optional. 559 */ 560 int ShClEventSignalEx(PSHCLEVENT pEvent, int rc, PSHCLEVENTPAYLOAD pPayload) 561 { 562 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); 563 564 Assert(pEvent->pPayload == NULL); 565 566 pEvent->rc = rc; 567 pEvent->pPayload = pPayload; 568 569 int rc2 = RTSemEventMultiSignal(pEvent->hEvtMulSem); 570 if (RT_FAILURE(rc2)) 571 pEvent->pPayload = NULL; /* (no race condition if consumer also enters the critical section) */ 572 573 LogFlowFuncLeaveRC(rc2); 574 return rc2; 575 } 576 577 /** 529 578 * Signals an event. 530 579 * … … 536 585 int ShClEventSignal(PSHCLEVENT pEvent, PSHCLEVENTPAYLOAD pPayload) 537 586 { 538 AssertPtrReturn(pEvent, VERR_INVALID_POINTER); 539 540 Assert(pEvent->pPayload == NULL); 541 542 pEvent->pPayload = pPayload; 543 544 int rc = RTSemEventMultiSignal(pEvent->hEvtMulSem); 545 if (RT_FAILURE(rc)) 546 pEvent->pPayload = NULL; /* (no race condition if consumer also enters the critical section) */ 547 548 LogFlowFuncLeaveRC(rc); 549 return rc; 587 return ShClEventSignalEx(pEvent, VINF_SUCCESS, pPayload); 550 588 } 551 589
Note:
See TracChangeset
for help on using the changeset viewer.