HTTP/1.1 -1 Read error in cache disk data: SuccessContent-Type: text/plain
Last-Modified: Tue, 07 Jul 2009 16:13:20 GMT
ETag: "57a49-3791-46e1fe6ad4800"
Content-length: 14225
Connection: Close
Proxy-Connection: Close
X-Cache: HIT from web1.osuosl.org
Server: ProxyTrack 0.5 (HTTrack 3.49.2)

Index: config/auto/thread.pm
===================================================================
--- config/auto/thread.pm	(revision 0)
+++ config/auto/thread.pm	(revision 0)
@@ -0,0 +1,67 @@
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+config/auto/thread.pm - Thread support
+
+=head1 DESCRIPTION
+
+Determining if the system has a Thread support.
+
+=cut
+
+package auto::thread;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+sub _init {
+    my $self = shift;
+    my %data;
+    $data{description} = q{Does your system has thread};
+    $data{result}      = q{};
+    return \%data;
+}
+
+sub runstep {
+    my ( $self, $conf ) = @_;
+
+    my ( $verbose, $without ) = $conf->options->get(
+        qw|
+            verbose
+            without-threads
+        |
+    );
+
+    if ($without) {
+        $conf->data->set( HAS_THREADS => 0 );
+        $self->set_result('no');
+        return 1;
+    }
+
+    if ($conf->data->get_p5('OSNAME') eq 'MSWin32'
+     || $conf->data->get('i_pthread') eq 'define') {
+        $conf->data->set( HAS_THREADS => 1 );
+        $self->set_result('yes');
+    }
+    else {
+        $conf->data->set( HAS_THREADS => 0 );
+        $self->set_result('no');
+    }
+
+    return 1;
+}
+
+1;
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Property changes on: config\auto\thread.pm
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: config/gen/platform/generic/threads.h
===================================================================
--- config/gen/platform/generic/threads.h	(revision 39906)
+++ config/gen/platform/generic/threads.h	(working copy)
@@ -9,17 +9,19 @@
  * POSIX threading stuff
  */
 
-#ifdef PARROT_HAS_HEADER_PTHREAD
+#ifdef PARROT_HAS_THREADS
+
 #  include "parrot/thr_pthread.h"
-#endif
 
-#ifdef PARROT_HAS_HEADER_UNISTD
-#  include <unistd.h>
-#  ifdef _POSIX_PRIORITY_SCHEDULING
-#    define YIELD sched_yield()
-#  endif
-#endif
+#  ifdef PARROT_HAS_HEADER_UNISTD
+#    include <unistd.h>
+#    ifdef _POSIX_PRIORITY_SCHEDULING
+#      define YIELD sched_yield()
+#    endif
+#  endif /* PARROT_HAS_HEADER_UNISTD */
 
+#endif /* PARROT_HAS_THREADS */
+
 #endif /* PARROT_PLATFORM_GENERIC_THREADS_H_GUARD */
 
 /*
Index: config/gen/platform/win32/threads.h
===================================================================
--- config/gen/platform/win32/threads.h	(revision 39906)
+++ config/gen/platform/win32/threads.h	(working copy)
@@ -6,8 +6,17 @@
 #ifndef PARROT_PLATFORM_WIN32_THREADS_H_GUARD
 #define PARROT_PLATFORM_WIN32_THREADS_H_GUARD
 
-#include "parrot/thr_windows.h"
+#undef CONST
+#include <windows.h>
 
+#ifdef PARROT_HAS_THREADS
+
+#  include "parrot/thr_windows.h"
+
+#endif /* PARROT_HAS_THREADS */
+
+#undef CONST
+
 #endif /* PARROT_PLATFORM_WIN32_THREADS_H_GUARD */
 
 /*
Index: include/parrot/atomic.h
===================================================================
--- include/parrot/atomic.h	(revision 39906)
+++ include/parrot/atomic.h	(working copy)
@@ -19,7 +19,7 @@
 
 #  define PARROT_HAS_NATIVE_ATOMIC 1      /* we'll redefine later if need be */
 
-#if (PARROT_HAS_THREADS)
+#ifdef PARROT_HAS_THREADS
 #  if defined(PARROT_HAS_I386_GCC_CMPXCHG)
 #    include "parrot/atomic/gcc_x86.h"
 #  elif defined(PARROT_HAS_PPC_GCC_CMPSET)
@@ -36,12 +36,12 @@
     void *val;
 } Parrot_atomic_pointer;
 
-typedef Parrot_atomic_integer {
+typedef struct Parrot_atomic_integer {
     INTVAL val;
 } Parrot_atomic_integer;
 
 #  define PARROT_ATOMIC_PTR_INIT(a)
-#  define PARROT_ATOMIC_PTR_GET(result, (a)) (result) = (a).val
+#  define PARROT_ATOMIC_PTR_GET(result, a) (result) = (a).val
 #  define PARROT_ATOMIC_PTR_SET(a, b) (a).val = (b)
 
 /* a is the Parrot_atomic.
@@ -65,7 +65,7 @@
 #  define PARROT_ATOMIC_PTR_DESTROY(a)
 #  define PARROT_ATOMIC_INT_INIT(a)
 #  define PARROT_ATOMIC_INT_DESTROY(a)
-#  define PARROT_ATOMIC_INT_GET(result, (a)) (result) = (a).val
+#  define PARROT_ATOMIC_INT_GET(result, a) (result) = (a).val
 #  define PARROT_ATOMIC_INT_SET(a, value)  (a).val = (value)
 #  define PARROT_ATOMIC_INT_CAS(result, a, expect, update) \
       do { \
Index: include/parrot/thr_pthread.h
===================================================================
--- include/parrot/thr_pthread.h	(revision 39906)
+++ include/parrot/thr_pthread.h	(working copy)
@@ -18,7 +18,6 @@
 
 #  include <pthread.h>
 
-#  define PARROT_SYNC_PRIMITIVES_DEFINED
 #  define LOCK(m) pthread_mutex_lock((pthread_mutex_t*)&(m))
 #  define UNLOCK(m) pthread_mutex_unlock((pthread_mutex_t*)&(m))
 #  define COND_WAIT(c, m) pthread_cond_wait(&(c), &(m))
Index: include/parrot/thr_windows.h
===================================================================
--- include/parrot/thr_windows.h	(revision 39906)
+++ include/parrot/thr_windows.h	(working copy)
@@ -13,14 +13,10 @@
 #ifndef PARROT_THR_WINDOWS_H_GUARD
 #define PARROT_THR_WINDOWS_H_GUARD
 
-#  undef CONST
-#  include <windows.h>
 #  undef FASTCALL
 #  include <process.h>
 #  include <limits.h>
 
-#  define PARROT_SYNC_PRIMITIVES_DEFINED
-
 typedef CRITICAL_SECTION Parrot_mutex;
 typedef struct Windows_cond
   {
@@ -131,8 +127,6 @@
 };
 #endif /* HAVE_STRUCT_TIMESPEC */
 
-#  undef CONST
-
 #endif /* PARROT_THR_WINDOWS_H_GUARD */
 
 /*
Index: include/parrot/thread.h
===================================================================
--- include/parrot/thread.h	(revision 39906)
+++ include/parrot/thread.h	(working copy)
@@ -14,15 +14,10 @@
 #define PARROT_THREAD_H_GUARD
 
 #  include "parrot/parrot.h"
-
-#  define PARROT_HAS_THREADS 1
 #  include "parrot/atomic.h"
 
-#ifndef PARROT_SYNC_PRIMITIVES_DEFINED
+#ifndef PARROT_HAS_THREADS
 
-#  undef  PARROT_HAS_THREADS
-#  define PARROT_HAS_THREADS 0
-
 #  define LOCK(m)
 #  define UNLOCK(m)
 #  define COND_WAIT(c, m)
@@ -51,15 +46,15 @@
 
 typedef void (*Cleanup_Handler)(void *);
 
-#  ifndef _STRUCT_TIMESPEC
-#    define _STRUCT_TIMESPEC
+#  ifndef __timespec_defined
+#    define __timespec_defined
 struct timespec {
     time_t tv_sec;
     long tv_nsec;
 };
-#  endif /* _STRUCT_TIMESPEC */
+#  endif /* __timespec_defined */
 
-#endif /* PARROT_SYNC_PRIMITIVES_DEFINED */
+#endif /* PARROT_HAS_THREADS */
 
 #ifndef YIELD
 #  define YIELD
Index: lib/Parrot/Configure/Options/Conf.pm
===================================================================
--- lib/Parrot/Configure/Options/Conf.pm	(revision 39906)
+++ lib/Parrot/Configure/Options/Conf.pm	(working copy)
@@ -96,6 +96,7 @@
    --execcapable        Use JIT to emit a native executable
    --gc=(type)          Determine the type of garbage collection
                         type=(gc|libc|malloc|malloc-trace) default is gc
+   --without-threads    Build parrot without thread support
 
 External Library Options:
 
Index: lib/Parrot/Configure/Options/Conf/Shared.pm
===================================================================
--- lib/Parrot/Configure/Options/Conf/Shared.pm	(revision 39906)
+++ lib/Parrot/Configure/Options/Conf/Shared.pm	(working copy)
@@ -72,9 +72,10 @@
     without-gdbm
     without-gettext
     without-gmp
+    without-icu
     without-opengl
     without-pcre
-    without-icu
+    without-threads
     yacc
 };
 
Index: lib/Parrot/Configure/Step/List.pm
===================================================================
--- lib/Parrot/Configure/Step/List.pm	(revision 39906)
+++ lib/Parrot/Configure/Step/List.pm	(working copy)
@@ -52,6 +52,7 @@
     auto::socklen_t
     auto::neg_0
     auto::env
+    auto::thread
     auto::gmp
     auto::readline
     auto::gdbm
Index: MANIFEST
===================================================================
--- MANIFEST	(revision 39906)
+++ MANIFEST	(working copy)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Jul  6 16:56:56 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Jul  6 17:51:00 2009 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -289,6 +289,7 @@
 config/auto/snprintf.pm                                     []
 config/auto/snprintf/test_c.in                              []
 config/auto/socklen_t.pm                                    []
+config/auto/thread.pm                                       []
 config/auto/va_ptr.pm                                       []
 config/auto/va_ptr/test_c.in                                []
 config/auto/warnings.pm                                     []
@@ -1981,6 +1982,7 @@
 t/steps/auto_sizes-01.t                                     [test]
 t/steps/auto_snprintf-01.t                                  [test]
 t/steps/auto_socklen_t-01.t                                 [test]
+t/steps/auto_thread-01.t                                    [test]
 t/steps/auto_va_ptr-01.t                                    [test]
 t/steps/auto_warnings-01.t                                  [test]
 t/steps/gen_call_list-01.t                                  [test]
Index: src/events.c
===================================================================
--- src/events.c	(revision 39906)
+++ src/events.c	(working copy)
@@ -1351,7 +1351,7 @@
 Parrot_sleep_on_event(PARROT_INTERP, FLOATVAL t, ARGIN_NULLOK(opcode_t *next))
 {
     ASSERT_ARGS(Parrot_sleep_on_event)
-#if PARROT_HAS_THREADS
+#ifdef PARROT_HAS_THREADS
 
     if (interp->sleeping)
         fprintf(stderr, "nested sleep might not work\n");
Index: src/scheduler.c
===================================================================
--- src/scheduler.c	(revision 39906)
+++ src/scheduler.c	(working copy)
@@ -1005,7 +1005,7 @@
 Parrot_cx_schedule_sleep(PARROT_INTERP, FLOATVAL time, ARGIN_NULLOK(opcode_t *next))
 {
     ASSERT_ARGS(Parrot_cx_schedule_sleep)
-#if PARROT_HAS_THREADS
+#ifdef PARROT_HAS_THREADS
     Parrot_cond condition;
     Parrot_mutex lock;
     const FLOATVAL timer_end = time + Parrot_floatval_time();
Index: t/pmc/threads.t
===================================================================
--- t/pmc/threads.t	(revision 39906)
+++ t/pmc/threads.t	(working copy)
@@ -7,6 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
 use Parrot::Test;
+use Parrot::Config;
 
 =head1 NAME
 
@@ -23,21 +24,6 @@
 
 =cut
 
-my %platforms = map { $_ => 1 } qw/
-    aix
-    cygwin
-    dec_osf
-    freebsd
-    hpux
-    irix
-    linux
-    netbsd
-    openbsd
-    solaris
-    MSWin32
-    darwin
-    /;
-
 if ( $^O eq "cygwin" ) {
     my @uname = split / /, qx'uname -v';
 
@@ -46,13 +32,11 @@
         exit;
     }
 }
-if ( $platforms{$^O} ) {
+if ( $PConfig{HAS_THREADS} ) {
     plan tests => 14;
 }
 else {
-    plan skip_all => "No threading yet or test not enabled for '$^O'";
-
-    # plan skip_all => "Needs COPY for argument passing";
+    plan skip_all => "No threading enabled for '$^O'";
 }
 
 pasm_output_is( <<'CODE', <<'OUTPUT', "interp identity" );
Index: t/pmc/timer.t
===================================================================
--- t/pmc/timer.t	(revision 39906)
+++ t/pmc/timer.t	(working copy)
@@ -7,6 +7,7 @@
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
 use Parrot::Test tests => 6;
+use Parrot::Config;
 
 =head1 NAME
 
@@ -24,19 +25,6 @@
 
 $ENV{TEST_PROG_ARGS} ||= '';
 
-my %platforms = map { $_ => 1 } qw/
-    aix
-    cygwin
-    darwin
-    dec_osf
-    freebsd
-    hpux
-    irix
-    linux
-    openbsd
-    MSWin32
-/;
-
 pasm_output_is( <<'CODE', <<'OUT', "Timer setup" );
 .include "timer.pasm"
     new P0, ['Timer']
@@ -100,7 +88,7 @@
 OUT
 
 SKIP: {
-    skip( "No thread config yet", 3 ) unless ( $platforms{$^O} );
+    skip( "No thread enabled", 3 ) unless ( $PConfig{HAS_THREADS} );
 
     pasm_output_like( <<'CODE', <<'OUT', "Timer setup - initializer/start" );
 .include "timer.pasm"
Index: t/steps/auto_thread-01.t
===================================================================
--- t/steps/auto_thread-01.t	(revision 0)
+++ t/steps/auto_thread-01.t	(revision 0)
@@ -0,0 +1,84 @@
+#! perl
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+use strict;
+use warnings;
+use Test::More tests => 8;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::auto::thread');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw(
+    test_step_thru_runstep
+    rerun_defaults_for_testing
+    test_step_constructor_and_description
+);
+use IO::CaptureOutput qw( capture );
+
+########## --without-threads ##########
+
+my ($args, $step_list_ref) = process_options(
+    {
+        argv => [ q{--without-threads} ],
+        mode => q{configure},
+    }
+);
+
+my $conf = Parrot::Configure->new;
+
+my $pkg = q{auto::thread};
+
+$conf->add_steps($pkg);
+
+my $serialized = $conf->pcfreeze();
+
+$conf->options->set( %{$args} );
+my $step = test_step_constructor_and_description($conf);
+my $ret = $step->runstep($conf);
+ok( $ret, "runstep() returned true value" );
+is($conf->data->get('HAS_THREADS'), 0,
+    "Got expected value for 'HAS_THREADS'");
+is($step->result(), q{no}, "Expected result was set");
+
+$conf->replenish($serialized);
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+auto_thread-01.t - test auto::thread
+
+=head1 SYNOPSIS
+
+    % prove t/steps/auto_thread-01.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test auto::thread.
+
+=head1 HISTORY
+
+Mostly taken from F<t/steps/auto_gdbm-01.t>.
+
+=head1 AUTHOR
+
+Francois Perrad
+
+=head1 SEE ALSO
+
+config::auto::thread, F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Property changes on: t\steps\auto_thread-01.t
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

</a></li><li><a href="/parrot/prefs">Preferences</a></li><li><a href="/parrot/wiki/TracGuide">Help/Guide</a>