Thread overview | |||||
---|---|---|---|---|---|
|
December 08, 2006 Proper way to make a thread wait using std.thread | ||||
---|---|---|---|---|
| ||||
Hi there, I'm trying to get a thread to wait every so often using std.thread, but using Thread.wait() to wait for another thread to end seems improper. Obviously, Thread.pause() and Thread.resume() are likely candidates to solve this problem, but I'd prefer that a thread pauses itself internally. Is there a simple way to do this? Thank you for your time, ~Morgan McDermott |
December 08, 2006 Re: Proper way to make a thread wait using std.thread | ||||
---|---|---|---|---|
| ||||
Posted in reply to Morgan McDermott | Morgan McDermott wrote:
> Hi there,
> I'm trying to get a thread to wait every so often using std.thread, but using Thread.wait() to wait for another thread to end seems improper. Obviously, Thread.pause() and Thread.resume() are likely candidates to solve this problem, but I'd prefer that a thread pauses itself internally. Is there a simple way to do this?
Not at the moment, as far as I'm aware. Thread really needs a static sleep method that calls Sleep on Win32 and usleep/sleep on Linux.
Sean
|
December 09, 2006 Re: Proper way to make a thread wait using std.thread | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | Sean Kelly wrote:
> Morgan McDermott wrote:
>> Hi there,
>> I'm trying to get a thread to wait every so often using std.thread, but using Thread.wait() to wait for another thread to end seems improper. Obviously, Thread.pause() and Thread.resume() are likely candidates to solve this problem, but I'd prefer that a thread pauses itself internally. Is there a simple way to do this?
>
> Not at the moment, as far as I'm aware. Thread really needs a static sleep method that calls Sleep on Win32 and usleep/sleep on Linux.
>
>
> Sean
It's a shame that there isn't already something in the standard lib =P. In any case, thanks for your help and time, Sean.
~Morgan McDermott
|
Copyright © 1999-2021 by the D Language Foundation