std.experimental.logger formal review round 3
via Digitalmars-d
digitalmars-d at puremagic.com
Fri Nov 14 14:24:07 PST 2014
On Friday, 14 November 2014 at 22:02:30 UTC, Steven Schveighoffer
wrote:
> I'm not following this thread, but please please please --
> output log data in chronological order.
I'm not sure if you can define a strict chronological order
between threads since logging happens "after the fact" which may
be truly parallel (in a race). If you want strict chronological
order between threads you can use an atomic counter for a serial
id…
For a web server this is usually not that interesting. You are
interested in chronological order on the first dispatch and then
on the request (the fiber id?)...
When you are doing buffering with one producer and one consumer
on a circular buffer you usually don't need locking or atomics
since single read/writes are atomic on x86 AFAIK. And with
double/triple buffering you only need an occasional CAS.
I can think of at least of 3-4 ways of getting a performant
multithreaded logger with almost no locking.
More information about the Digitalmars-d
mailing list