Re: Simple pthread question

2001-10-31 Thread Stephen Montgomery-Smith

I have successfully used sleep in this situation.  I wanted a process that
activated every hour (it did some "garbage collection"), so it went something
like

while (1) {
  sleep(3600);
  do_stuff();
}

and the other threads worked fine.


Arjan Knepper wrote:
> 
> How do I suspend one particular thread without suspending the whole process?
> I can not use sleep or usleep can I?
> 
> TIA
> Arjan
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message

-- 

Stephen Montgomery-Smith
[EMAIL PROTECTED]
http://www.math.missouri.edu/~stephen

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Simple pthread question

2001-10-31 Thread Sansonetti Laurent

On Wed, 2001-10-31 at 08:26, Arjan Knepper wrote:
> How do I suspend one particular thread without suspending the whole process?
> I can not use sleep or usleep can I?

You can use them, since they use nanosleep() which is I think
re-entrant.

If you are using digital unix pthreads implementation, there is
something like pthread_delay_np() which you can still use.

Hope that helps.

> 
> TIA
> Arjan
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
-- 

--
Sansonetti Laurent - http://lrz.linuxbe.org



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Simple pthread question

2001-10-31 Thread Stephen Montgomery-Smith

Arjan Knepper wrote:
> 
> How do I suspend one particular thread without suspending the whole process?
> I can not use sleep or usleep can I?
> 

Also, if you do 

apropos pthread

you will see listed a whole bunch of functions, some of which may be more
suitable for you, depending upon your particular problem, for example

pthread_cond_timedwait

-- 

Stephen Montgomery-Smith
[EMAIL PROTECTED]
http://www.math.missouri.edu/~stephen

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message