Skip to content

Commit

Permalink
fix: __sigval_t causes compile error (#21)
Browse files Browse the repository at this point in the history
Signed-off-by: Super-long <[email protected]>
  • Loading branch information
Super-long authored Oct 30, 2022
1 parent 7b12302 commit 8987035
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion util/dns_resolve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ struct NotifyStruct {
fibers_ext::EventCount evc;
};

static void DnsResolveNotify(__sigval_t val) {
// To ensure compatibility between different versions of Glibc,
// we use sigval_t instead of __sigval_t. However, some older
// versions may still require __sigval_t, such as when __USE_POSIX199309
// is defined. The following text is derived from the comments in Glibc 2.31:
// To avoid sigval_t (not a standard type name) having C++ name
// mangling depending on whether the selected standard includes union
// sigval, it should not be defined at all when using a standard for
// which the sigval name is not reserved; in that case, headers should
// not include <bits/types/sigval_t.h> and should use only the
// internal __sigval_t name.
static void DnsResolveNotify(sigval_t val) {
NotifyStruct* ns = (NotifyStruct*)val.sival_ptr;
ns->gate.store(true, memory_order_relaxed);
ns->evc.notify();
Expand Down

0 comments on commit 8987035

Please sign in to comment.