ChinaUnix.net
相关文章推荐:

localtime 多线程

线程localtime会有问题不

by ww2000e - C/C++ - 2012-02-08 10:17:47 阅读(2068) 回复(1)

相关讨论

新手请教: 请问各位怎么样能在线程环境下使用localtime,而不是localtime_r

by cnforyou - C/C++ - 2005-03-25 09:39:10 阅读(2982) 回复(4)

#include #include void test(char *arg) { pthread_detach(pthread_self()); struct tm now; time_t datetime; while (1) { time (&datetime); localtime_r(&datetime, &now); usleep(10); } } int main() { int rt; int tid[7]; pthread_create(&tid[0], NULL, test, NULL); pthread_create(&tid[1], NULL,...

by wzabcd1234 - C/C++ - 2010-06-25 16:40:29 阅读(4707) 回复(5)

我在 SUN880 Solaris8上开发了一个线程程序,使用pthread线程,用 cc 编译器进行编译。 程序的线程结构是这样,主线程启动后创建了4个 pthread 线程,这四个 pthread 线程一直运行,直到进程结束才退出。因为需要在线程中同时获取系统时间,所以程序中使用了 localltime_r 函数。各个线程中对 localltime_r 的调用频度很高,每秒平均 200 次,现在发现这样的问题,程序运行起来后,10几秒很快出现内存访问错误。用dbx查看...

by tu2y - C/C++ - 2008-09-25 11:05:10 阅读(4257) 回复(4)

我在 SUN880 Solaris8上开发了一个线程程序,使用pthread线程,用 cc 编译器进行编译。 程序的线程结构是这样,主线程启动后创建了4个 pthread 线程,这四个 pthread 线程一直运行,直到进程结束才退出。因为需要在线程中同时获取系统时间,所以程序中使用了 localltime_r 函数。各个线程中对 localltime_r 的调用频度很高,每秒平均 200 次,现在发现这样的问题,程序运行起来后,10几秒很快出现内存访问错误。用dbx查看...

by tu2y - Solaris - 2004-07-14 20:00:19 阅读(815) 回复(2)

我在 SUN880 Solaris8上开发了一个线程程序,使用pthread线程,用 cc 编译器进行编译。\r\n 程序的线程结构是这样,主线程启动后创建了4个 pthread 线程,这四个 pthread 线程一直运行,直到进程结束才退出。因为需要在线程中同时获取系统时间,所以程序中使用了 localltime_r 函数。各个线程中对 localltime_r 的调用频度很高,每秒平均 200 次,现在发现这样的问题,程序运行起来后,10几秒很快出现内存访问错误。用dbx...

by tu2y - Solaris - 2004-07-14 20:00:19 阅读(2704) 回复(2)

我知道在UNIX环境下localtime线程不安全的; 记得前段时间读Win高级编程,上面说有些c运行时函数已该为线程安全的,但不知有没有localtime(). 上网搜了一下,都没提Windows下是否安全. 有用过的请指点迷津

by h6n6p - C/C++ - 2003-11-27 15:30:02 阅读(1473) 回复(0)

1、Definition and Usage 定义和用法 The localtime() function returns an array that contains the time components of a Unix timestamp. localtime()函数的作用是:以数组的形式返回本地时间。 2、Syntax 语法 localtime(timestamp,is_associative) Parameter参数 Description描述 timestamp Optional. Specifies the date or time to be formatted. If no timestamp is specified, it uses the current local time. 可选参数。...

by ruoyisiyu - php文档中心 - 2007-09-11 17:03:19 阅读(1017) 回复(0)

使用stat取到文件属性,使用其中的时间,然后用localtime转换为年月日的形式,但这个时间和正确的时间相差一个月.

by avcodec - C/C++ - 2014-08-09 17:30:35 阅读(3629) 回复(9)

my @today = split(/\s/, localtime); print Dumper(\@today), "
"; $VAR1 = [ 'Tue', 'Jan', '19', '20:24:36', '2010' ]; 所以year应该是 $today[4] 但是为什么最近发现有时候是 $today[5]才是year呢 难道是因为 split(/\s/, localtime) 的问题吗? 有没有人遇到过? 直接print localtime的话 结果是这样的: 3624201901102180 这个怎么 split(/\s/, localtime)呢?

by actan - Perl - 2010-01-20 13:09:48 阅读(3205) 回复(10)

操作环境:solaris 8 现象:程序启动,运行正常,但是运行一段时间之后,localtime_r 转换时间就比当前时间要晚16个小时,从而导致程序出现异常 如果是时区的环境变量变化了引起的,在程序启动的时候不就已经确定环境变量了?

by foolishfox - C/C++ - 2011-05-25 10:35:54 阅读(2673) 回复(3)