z***c 发帖数: 1 | 1 Hi, dear all:
after forking several threads, the main thread needs to
wait for some
time interval to continue.
1: I can not use Sleep() since it will make all threads
sleep.
2: when I use delay(), it needs another function to convert
seconds into ticks.
but when I compile it , it seems the compiler can not
reference to these functions, do I have to link it with some
libraries?
3: In some examples, I saw something like
pthread_deley_np(), but I cannot
find with man in my unix machine.
a | t******q 发帖数: 117 | 2 Hi,
why do you need to wait the time?
can you use a global variable setted by main and resetted by
the
thread, polling by the main thread.
1, you can use your own defined global variable
2, you can do that is use pthread_mutex.
3, another way is to use pthread_condattr_init to
synchronize the threads.
Suppose you do not need precise time just need the thread to
initilized. I use Linux
I use linux can not find delay.
I think you have to link the lib file too seems.
This is a RT_linux near_POSIX a | b*e 发帖数: 3845 | 3
I remember u can only fork child process. Threads are not
forked. So u can just use sleep in the main thread routine.
All done.
【在 z***c 的大作中提到】 : Hi, dear all: : after forking several threads, the main thread needs to : wait for some : time interval to continue. : 1: I can not use Sleep() since it will make all threads : sleep. : 2: when I use delay(), it needs another function to convert : seconds into ticks. : but when I compile it , it seems the compiler can not : reference to these functions, do I have to link it with some
|
|