由买买提看人间百态

topics

全部话题 - 话题: usleep
(共0页)
C********e
发帖数: 219
1
来自主题: Programming版 - 求助调试c++程序
接手了一个c++的程序,以前的程序员不愿意指导,自己也比较愚钝。请大侠们指点
不明白为什么usleep(1000)发生overflow?是因为其他线程有overflow的情况吗?如何
查看其他线程里面的变量值呢?
Program terminated with signal 6, Aborted.
#0 0x0000003cfd89a1e1 in nanosleep () from /lib64/libc.so.6
(gdb) bt
#0 0x0000003cfd89a1e1 in nanosleep () from /lib64/libc.so.6
#1 0x0000003cfd8ce8f4 in usleep () from /lib64/libc.so.6
#2 0x0000000000498e17 in MyClass::StartUp (this=0x2b4484725010, aName=
Traceback (most recent call last):
File "/usr/share/gdb/python/libstdcxx/v6/printers.py", lin... 阅读全帖
a***c
发帖数: 2443
2
embedded is the general direction I want to go in, something about
seeing an end-product/mobile device take shape just fascinates me
(like an ipod), versus say a baseband chip. But from what I see,
employers rarely hire fresh grads for embedded hardware positions.
They want even more experience for firmware engineers. The easiest way
to get in is as an embedded software engineer, I think. Given that my
MS research is mostly on networks, and my grad classes were more
theory-based than project-ba... 阅读全帖
s*****e
发帖数: 21415
3
来自主题: PhotoGear版 - [bssd]bloomberg干吗招非cs的码工?
现实是linux C里面有nanosleep,和usleep。。。
nanosleep 理论上最小分辨率是10^-9,当然,context switching也是存在的。
所以实际上精度没有那么高。
但是基本上microsecond级别是可以保证的。
C#不知道吃啥了,一睡最起码10ms ...
就算是windows API调用也没有精度那么低的
n****g
发帖数: 14743
4
来自主题: Programming版 - C里面的延时函数
usleep 可以用
我现在想 win32 下用 vc 也可以通用的函数就好了。
x******g
发帖数: 3952
5
来自主题: Programming版 - 怎样在LINUX下C++程序里延迟1ms
usleep will prevent your process from being scheduled for
at least the specified time.
C********e
发帖数: 219
6
来自主题: Programming版 - 求助调试c++程序
这就是不解之处啊。
那个1000怎么也不会大于usleep允许的最大值吧?而且这个程序也不是一直出问题。现
在一共80个实例在运行,只有两个最近开始出问题的。其中一个是live site的,另一
个是DR site的。
m*******l
发帖数: 12782
7
来自主题: Programming版 - 求助调试c++程序
usleep should be able to take a value less than 1M.
T********i
发帖数: 2416
8
来自主题: Programming版 - 请推荐C++开发环境
给你一个好了。thread和sleep。
disclaimer: 这个也是我抄的。
typedef void * (*qw_thread_func_t)(void *);
#if defined(_WIN32)
inline int qw_start_thread(qw_thread_func_t f, void *p) {
return (long)_beginthread((void(__cdecl *)(void *)) f, 0, p) == -1L ? -1
: 0;
}
#define qw_sleep(x) Sleep(x)
#else
inline int qw_start_thread(qw_thread_func_t func, void *param) {
pthread_t thread_id;
pthread_attr_t attr;
int result;
(void)pthread_attr_init(&attr);
(void)pthread_attr_setdetachstate(&attr, PTHRE... 阅读全帖
a****s
发帖数: 47
9
来自主题: Unix版 - [转载] alarm, pause 又一问
【 以下文字转载自 Programming 讨论区 】
【 原文由 abatis 所发表 】
Any alarm function that has precision of microsecond?
I have to use alarm function, and it seems I cannot use
usleep or nanosleep, cause the document says not
to mixing them.
It didn't say don't mix up alarm and pause, but I wonder
if alarm and pause are mixed, some problem will arise?
c******n
发帖数: 4965
10
【 以下文字转载自 THU 讨论区 】
【 原文由 creation 所发表 】
要交project,
本来觉得很简单的问题,想着半天就应该做出来,
可逐渐发现现有的 packages 都不完全合适
a distributed algorithm protocol implementation
3 phase commit,
I need to show the effect of message delay ,so
I need to introduce artificial delay to real API xxx_send
I do this by spawning a POSIX thread, and then
do usleep() and XXX_send in that thread,
I use PVM for different processes, this is an overkill
but very easy to use because PVM has timed recv, ( I need timeout
in the protocol, and i
(共0页)