tcpdump mailing list archives
Re: Use of critical section on Win32
From: Guy Harris <guy () alum mit edu>
Date: Tue, 14 May 2013 10:27:17 -0700
On May 14, 2013, at 8:21 AM, Gisle Vanem <gvanem () broadpark no> wrote:
I really don't understand the motivation behind the Win32-code for pcap_compile().
I assume the motivation is that pcap_compile() is not thread-safe. It's no more thread-safe on UN*X, so if the goal is to allow programs to use it without having to lock out other threads using it, we should perhaps use a pthread mutex if they're available... ...except if you're using Grand Central Dispatch rather than pthreads, in which case we should do what's appropriate for GCD. Then again, sufficiently recent versions of Flex can generate thread-safe lexical analyzers; if we can also generate a thread-safe parser (e.g., with Bison or some more modern flavor of YACC), we could probably incorporate the remaining global variables into a structure and make it thread-safe *if* the right tools are used to generate the parser and lexer.
Why doesn't other libpcap functions needs this critical-section protection too?
Because they're thread-safe. _______________________________________________ tcpdump-workers mailing list tcpdump-workers () lists tcpdump org https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
Current thread:
- Use of critical section on Win32 Gisle Vanem (May 14)
- Re: Use of critical section on Win32 Guy Harris (May 14)