]> The Tcpdump Group git mirrors - libpcap/commit
Have a structure holding a "do we have a thread" flag and a thread handle.
authorGuy Harris <[email protected]>
Thu, 26 Apr 2018 18:28:51 +0000 (11:28 -0700)
committerGuy Harris <[email protected]>
Thu, 26 Apr 2018 18:28:51 +0000 (11:28 -0700)
commit4c7a44dab99b07a2673d14aba2cf579347ec0dec
treebda4f61370bdc9fd65a09bbb94fd3419b21ad591
parent9bac75ac0222df31e29ecacf2da423702b3e5c3d
Have a structure holding a "do we have a thread" flag and a thread handle.

If there were a distinguished value for a pthread_t that means "no
thread", we wouldn't need this, but there isn't, so we do need this.

(It's somewhat like an Optional<thread> in Swift.)

This cleans up some "reference to uninitialized data" warnings on
Windows (not sure why we didn't get the same warnings on UN*X, as you're
still passing an uninitialized pthread_t, although it may not be obvious
to a compiler that, if pthread_create() fails, it won't necessarily
initialize the pointed-to pthread_t), and gets rid of some cases where
we need different function signatures on Windows and UN*X.

It also forces the "does this handle refer to a thread?" flag and the
handle itself to travel together.
rpcapd/daemon.c