feat(libwebrtc): implement rtc::PlatformThread Finalize, destructor and move assignment for threads without a join #15270
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15270"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by alvaroelpob on 2026-11-02T22:35:26Z.
What
Implements
rtc::PlatformThread::Finalize(),~PlatformThread()andoperator=(PlatformThread&&)in libwebrtc, which threw and were declared without parameters, except for threads that must be joined.The module's WebRTC revision lies between M127 and M134, as recorded in the debt file. The POSIX path of
platform_thread.cc(M127, M134) is the same at both, apart fromabsl::optionalagainststd::optional.src/PlatformThread.cppstarts with that file's WebRTC notice and the BSD licence.WebRtcPlatformThreadis the 24-byte layout ofplatform_thread.h: an optionalpthread_twith its flag at 8, andjoinable_at 16. The size was checked against a hoststd::optional<pthread_t>.Finalizeand the destructor do nothing without a handle and clear a detached thread's handle.joinable_, and clears the source's handle.Finalizing a joinable thread means
pthread_joinon the guest thread, which this library cannot call yet. That throws throughNotImplemented_nid_no_patch, and a move assignment onto such a thread throws before changing either object; both are recorded as debt. A null thread throws. It removes 3 exports from the inventory.Tested
Ubuntu 26.04 (WSL2, kernel 6.18), GCC 15.2.0, Release, full build with
BUILD_TESTING=ON.guest_webrtc_platform_threadtest:std::runtime_errorfromFinalizeand the destructor and keeps its handle.this, moves handle andjoinable_and clears the source, also between empty threads.ctest -j16on head 5853d5e153: 3596/3596 pass.check_conventions.py --base upstream/mainpasses.pr_overlap.py: no open pull request implements these functions. The shared lines are the pending-export count indocs/dev/debt/libwebrtc.mdand the source, test and declaration lists inCMakeLists.txtandApi.hpp.main4f41f4c375, head 3eeac50e24, to resolve the conflicts on the sharedCMakeLists.txt,Export.cppand debt-file lines; both sides are kept and the debt count is recomputed fromExport.cpp. Full build andctest -j16: 3796/3800 pass;guest_sce_net,guest_poll,guest_select_waitandguest_memoryfailed under that load, pass when run alone, andmain4f41f4c375passes all 3799 with-j16on the same machine.check_conventions.py --base upstream/mainpasses.pthread_joinand adds theDerived fromline; the test checks the join, a failing join and that the vtable pointer is kept. Full build andctest -j16: 3796/3800 pass;guest_sce_net,guest_poll,guest_select_waitandguest_memoryfail only when the suite runs as a background job here, and pass when run in the foreground on this head and onmain.check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)