File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -106,8 +106,8 @@ impl PcapHandle {
106106}
107107
108108// `PcapHandle` is safe to Send as it encapsulates the entire lifetime of `raw::pcap_t *`, but it is
109- // not safe to Sync as libpcap does not promise thread-safe access to the same `raw::pcap_t *` from
110- // multiple threads .
109+ // `PcapHandle` is only Sync under special circumstances when used in thread-safe functions such as
110+ // the `pcap_breakloop` function. The Sync correctness is left to the wrapping structure to provide .
111111unsafe impl Send for PcapHandle { }
112112
113113impl Drop for PcapHandle {
@@ -118,6 +118,9 @@ impl Drop for PcapHandle {
118118
119119unsafe impl < T : State + ?Sized > Send for Capture < T > { }
120120
121+ // `Capture` is not safe to implement Sync as the libpcap functions it uses are not promised to have
122+ // thread-safe access to the same `raw::pcap_t *` from multiple threads.
123+ #[ allow( clippy:: arc_with_non_send_sync) ]
121124impl < T : State + ?Sized > From < NonNull < raw:: pcap_t > > for Capture < T > {
122125 fn from ( handle : NonNull < raw:: pcap_t > ) -> Self {
123126 Capture {
You can’t perform that action at this time.
0 commit comments