Using pthread in Swift

I am trying to use a C library (e.g. libfoo) by using Swift Package
manager to create a module map for the C library and import it into
Swift code. I was able to do this for a few other libraries without
any issue. In this case, the header file of the C library includes
<pthread.h>, which seems to cause conflicts with the Glibc module.

Here is an excerpt from the compiler errors:

/home/bryanpkc/src/ModuleBug/SwiftLibFoo/Packages/CLibFoo-1.0.0/Sources/include/foo.h:5:1:
error: declaration of 'pthread_mutex_t' must be imported from module
'SwiftGlibc.C.signal' before it is required
pthread_mutex_t *getFooMutex();
^
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:128:3: note:
previous declaration is here
} pthread_mutex_t;
  ^

What is the correct way to do this? Why isn't swiftc able to tell that
pthread.h belongs to Glibc, and avoid parsing it again as part of
foo.h?

···

--
Bryan