由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - A thread question
相关主题
像QQ/FB chat/GTalk这些是怎么实时检查用户状态?How to initialize object in constructor?
Java 多线程 的架构如何改进?GCC 居然允许变量长度的向量
我用vi的体会a question about CGI
问一个思路:如何创建并监听虚拟网卡全局对象
Daemon thread谁给解释下这个比较弱的问题?
问个Java问题一个简单的算法问题?
[转载] 简单的题都不敢做了.int64_t printf
little endian vs big endian问一道C++的题目。 (转载)
相关话题的讨论汇总
话题: pid话题: int话题: daemon话题: thread话题: sys
进入Programming版参与讨论
1 (共1页)
q***z
发帖数: 934
1
Hello I am new on threads.
I am reading this example code, however, I can't understand it,
even though I search the usage of setpid, umask.
Can anyone explain it for me?
What's daemon?
Thank you very much!
#include
#include
int daemon_init(void)
{pid_t pid, pid1;
if((pid=fork())<0) exit(-1);
else if(pid)
{printf("pid=%d\n",(int)pid);e­xit( 0);} /* parent */
/* child */
printf("uid=%d gid=%d egid=%d \n",
(int) getuid(),(int) getgid(),(int) getegid() );
c********e
发帖数: 383
2
what didnt u understand? the whole thing?
why dont u just run the program and see what it does.

【在 q***z 的大作中提到】
: Hello I am new on threads.
: I am reading this example code, however, I can't understand it,
: even though I search the usage of setpid, umask.
: Can anyone explain it for me?
: What's daemon?
: Thank you very much!
: #include
: #include
: int daemon_init(void)
: {pid_t pid, pid1;

1 (共1页)
进入Programming版参与讨论
相关主题
问一道C++的题目。 (转载)Daemon thread
Question on using ## in #define问个Java问题
一道c[转载] 简单的题都不敢做了.
C/C++函数调用和栈内存little endian vs big endian
像QQ/FB chat/GTalk这些是怎么实时检查用户状态?How to initialize object in constructor?
Java 多线程 的架构如何改进?GCC 居然允许变量长度的向量
我用vi的体会a question about CGI
问一个思路:如何创建并监听虚拟网卡全局对象
相关话题的讨论汇总
话题: pid话题: int话题: daemon话题: thread话题: sys