Browse code

more careful guess at Windows support for Team

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Streamer@68797 bc3139a8-67e5-0310-9ffc-ced21a209358

Martin Morgan authored on 25/08/2012 04:57:12
Showing 4 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: Streamer
2 2
 Type: Package
3 3
 Title: Enabling stream processing of large files
4
-Version: 1.3.6
4
+Version: 1.3.7
5 5
 Author: Martin Morgan, Nishant Gopalakrishnan
6 6
 Maintainer: Martin Morgan <mtmorgan@fhcrc.org>
7 7
 Description: Large data files can be difficult to work with in R,
... ...
@@ -118,6 +118,8 @@
118 118
 Team <-
119 119
     function(FUN, size=1L, mc.set.seed=TRUE, silent=TRUE, ...)
120 120
 {
121
+    if (.Platform$OS.type != "unix")
122
+        stop("'Team' not supported on platform '", .Platform$OS.type, "'")
121 123
     require(parallel)
122 124
     if (size < 1L)
123 125
         stop("'size' must be >= 1")
... ...
@@ -1,9 +1,10 @@
1
-.mc_parallel <- .mc_collect <- .mc_sendMaster <- .mc_kill <- NULL
1
+.mc_parallel <- .mc_collect <- .mc_sendMaster <- .mc_kill <-
2
+    function(...) {}
2 3
 
3 4
 .onLoad <-
4 5
     function(libname, pkgname)
5 6
 {
6
-    if (tools:::.OStype() == "unix") {
7
+    if (.Platform$OS.type == "unix") {
7 8
         ## conditional export in Windows
8 9
         .mc_parallel <<- parallel::mcparallel
9 10
         .mc_collect <<- parallel::mccollect
... ...
@@ -108,12 +108,13 @@
108 108
 }
109 109
 
110 110
 \examples{
111
-team <- Team(function(x) { Sys.sleep(1); mean(x) }, size=5)
112
-s <- stream(Seq(to=50, length.out=5), team)
113
-system.time({
114
-    while(length(y <- yield(s)))
111
+if (.Platform$OS.type != "windows") {
112
+    team <- Team(function(x) { Sys.sleep(1); mean(x) }, size=5)
113
+    s <- stream(Seq(to=50, length.out=5), team)
114
+    system.time({while(length(y <- yield(s)))
115 115
         print(y)
116
-})
116
+    })
117
+}
117 118
 }
118 119
 
119 120
 \keyword{classes}