summaryrefslogtreecommitdiffstats
path: root/process.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-01 10:49:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-01-01 10:49:14 +0000
commitd8b8579bc694d0fdf639aa2fe7ddf13cf5fdf0e7 (patch)
tree4473c38a65560d2513be229301b411d6b02e9339 /process.c
parent4500cd1ca03c938a4c7c259dd4410843a9d95e7f (diff)
downloadruby-d8b8579bc694d0fdf639aa2fe7ddf13cf5fdf0e7.tar.gz
ruby-d8b8579bc694d0fdf639aa2fe7ddf13cf5fdf0e7.tar.xz
ruby-d8b8579bc694d0fdf639aa2fe7ddf13cf5fdf0e7.zip
* process.c (rb_proc_times): avoid WindowsXP crash using volatile
variables. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/process.c b/process.c
index 38592794c..41a00154e 100644
--- a/process.c
+++ b/process.c
@@ -1261,13 +1261,17 @@ rb_proc_times(obj)
# endif
#endif /* HZ */
struct tms buf;
+ VALUE volatile utime = rb_float_new((double)buf.tms_utime / HZ);
+ VALUE volatile stime = rb_float_new((double)buf.tms_stime / HZ);
+ VALUE volatile cutime = rb_float_new((double)buf.tms_cutime / HZ);
+ VALUE volatile sctime = rb_float_new((double)buf.tms_cstime / HZ);
times(&buf);
return rb_struct_new(S_Tms,
- rb_float_new((double)buf.tms_utime / HZ),
- rb_float_new((double)buf.tms_stime / HZ),
- rb_float_new((double)buf.tms_cutime / HZ),
- rb_float_new((double)buf.tms_cstime / HZ));
+ utime,
+ stime,
+ cutime,
+ sctime);
#else
rb_notimplement();
#endif