Make the code work without USE_ITHREADS. FreeBSD's default Perl build
authorDerrik Pates <demon@now.ai>
Wed, 29 Jun 2011 01:08:27 +0000 (19:08 -0600)
committerDerrik Pates <demon@now.ai>
Wed, 29 Jun 2011 01:08:27 +0000 (19:08 -0600)
doesn't enable threads (it can be enabled), so let's try to be a bit
more accepting.

Fuse.xs
README

diff --git a/Fuse.xs b/Fuse.xs
index fb3686f..f84aa49 100755 (executable)
--- a/Fuse.xs
+++ b/Fuse.xs
 typedef struct {
        SV *callback[N_CALLBACKS];
        HV *handles;
 typedef struct {
        SV *callback[N_CALLBACKS];
        HV *handles;
+#ifdef USE_ITHREADS
        tTHX self;
        tTHX self;
+#endif
        int threaded;
        int threaded;
+#ifdef USE_ITHREADS
        perl_mutex mutex;
        perl_mutex mutex;
+#endif
 } my_cxt_t;
 START_MY_CXT;
 
 } my_cxt_t;
 START_MY_CXT;
 
@@ -1520,14 +1524,19 @@ PROTOTYPES: DISABLE
 
 BOOT:
        MY_CXT_INIT;
 
 BOOT:
        MY_CXT_INIT;
+#ifdef USE_ITHREADS
        MY_CXT.self = aTHX;
        MY_CXT.self = aTHX;
+#endif
 
 void
 CLONE(...)
        PREINIT:
 
 void
 CLONE(...)
        PREINIT:
+#ifdef USE_ITHREADS
                int i;
                dTHX;
                int i;
                dTHX;
+#endif
        CODE:
        CODE:
+#ifdef USE_ITHREADS
                MY_CXT_CLONE;
                tTHX parent = MY_CXT.self;
                MY_CXT.self = my_perl;
                MY_CXT_CLONE;
                tTHX parent = MY_CXT.self;
                MY_CXT.self = my_perl;
@@ -1559,6 +1568,7 @@ CLONE(...)
                        clone_params_del(clone_param);
 #endif
                }
                        clone_params_del(clone_param);
 #endif
                }
+#endif
 
 SV*
 fuse_get_context()
 
 SV*
 fuse_get_context()
diff --git a/README b/README
index 229e9ee..1a66bce 100644 (file)
--- a/README
+++ b/README
@@ -93,18 +93,7 @@ Currently tests have been attempted and succeeded on:
   * FreeBSD 8.2/amd64
   * MacOS X 10.6.7
 
   * FreeBSD 8.2/amd64
   * MacOS X 10.6.7
 
-Note that currently, this module requires a threaded Perl. This is not a
-problem on most operating systems, but FreeBSD does not build Perl in
-ports with threading enabled. You'll need to build it yourself. You can use
-Perl 5.8, 5.10, or 5.12, but you'll need to:
-
-  cd /usr/ports/lang/perl$VERSION
-  make config
-  [enable THREADS and choose OK]
-  make
-  make install
-
-Also note that on NetBSD, there are several bugs in libpuffs and librefuse
+Note that on NetBSD, there are several bugs in libpuffs and librefuse
 which prevent some tests from succeeding. There are fixes in NetBSD's
 MAIN branch, specifically revisions 1.26 and 1.27 on src/lib/libpuffs/subr.c,
 which correct the issues that cause the test failures. However, there is
 which prevent some tests from succeeding. There are fixes in NetBSD's
 MAIN branch, specifically revisions 1.26 and 1.27 on src/lib/libpuffs/subr.c,
 which correct the issues that cause the test failures. However, there is