Thread overview | |||||
---|---|---|---|---|---|
|
March 06, 2016 is module ( std.experimental.logger) thread-safe. | ||||
---|---|---|---|---|
| ||||
I want to use the filelogger to my application. is the sharedLog() global and thread-safe. |
March 10, 2016 Re: is module ( std.experimental.logger) thread-safe. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dsby | On Sunday, 6 March 2016 at 09:54:49 UTC, Dsby wrote:
> I want to use the filelogger to my application.
> is the sharedLog() global and thread-safe.
Yes, `FileLogger` internally uses `lockingTextWriter`, so it should be safe to call from multiple threads. Furthermore, the `sharedLog` property uses atomic load and store instructions, so it should be OK to concurrently change the shared logger.
|
March 11, 2016 Re: is module ( std.experimental.logger) thread-safe. | ||||
---|---|---|---|---|
| ||||
Posted in reply to ZombineDev | On Thursday, 10 March 2016 at 23:56:14 UTC, ZombineDev wrote:
> On Sunday, 6 March 2016 at 09:54:49 UTC, Dsby wrote:
>> I want to use the filelogger to my application.
>> is the sharedLog() global and thread-safe.
>
> Yes, `FileLogger` internally uses `lockingTextWriter`, so it should be safe to call from multiple threads. Furthermore, the `sharedLog` property uses atomic load and store instructions, so it should be OK to concurrently change the shared logger.
Thanks.
I was test and used in my mutil-threads application.
It works fine.
|
Copyright © 1999-2021 by the D Language Foundation