summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPeter Stuge <peter@stuge.se>2010-05-11 00:51:43 +0100
committerDaniel Drake <dan@reactivated.net>2010-05-12 22:11:29 -0300
commit23b5db8b3e353176dfa0635bfb6f0e2658f6e3de (patch)
treefa8d63b97d0ae45724eb2ebd2cc13853dae93993 /examples
parenta04cbb0095a78aeed3f65aaf06c46069d0ac184a (diff)
downloadlibusb-23b5db8b3e353176dfa0635bfb6f0e2658f6e3de.tar.gz
Add internal abstraction for POSIX Threads
This prepares for a Windows backend without dependency on pthreads-w32. pthread_* is renamed to usbi_* and PTHREAD_* to USBI_*. A usbi_mutex_static_t and usbi_mutex_static_lock() and _unlock() are introduced for statically initialized mutexes, since they may be implemented using other types when pthreads mutexes aren't used. Move -pthread from libusb/Makefile.am to host-specific THREAD_CFLAGS in configure.ac. This will enable optional use of -lpthread for cygwin. [dsd: minor tweaks, and roll in a change based on patches from Pete Batard to only build dpfp_threaded example when we're using pthreads]
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 600ebd4..bed1837 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,5 +1,5 @@
INCLUDES = -I$(top_srcdir)
-noinst_PROGRAMS = lsusb dpfp dpfp_threaded
+noinst_PROGRAMS = lsusb dpfp
lsusb_SOURCES = lsusb.c
lsusb_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
@@ -7,7 +7,10 @@ lsusb_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
dpfp_SOURCES = dpfp.c
dpfp_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
+if THREADS_POSIX
dpfp_threaded_SOURCES = dpfp_threaded.c
-dpfp_threaded_CFLAGS = -pthread $(AM_CFLAGS)
+dpfp_threaded_CFLAGS = $(THREAD_CFLAGS) $(AM_CFLAGS)
dpfp_threaded_LDADD = ../libusb/libusb-1.0.la -lusb-1.0
+noinst_PROGRAMS += dpfp_threaded
+endif