I personally would not recommend to log within a library (avoid external
dependencies). This constraints the library consumer; for instance you don't
know which logging libary the application uses; the environment (mobile,
server), the logging-language and so on. If you do API design it's better
We had something like that and removed it because it is racy. You can call
`registerThreadLocalInitialiser` after a thread has been created.
Mayby, the better solution is just to do explicit "eager" initialisation of
threadvars, assuming the dev can insert code at all thread creation points.
This seems to work:
import locks
type
InitThreadLocalsProc* = proc(): void {.nimcall, gcsafe.}
## Type of a
Maybe attempt #1 when you make `getValue` a `.dirty` template with a `when not
declared` check to prevent multiple declarations of the thread var. Seems a bad
hack though.
I've been wondering if something like Java's ThreadLocal (which I use a
massively in (Java) server-side code), could be defined in Nim.
I tried those two approaches, but neither is valid code. It seems to me it
isn't possible.
Attempt #1:
type
ThreadLocal*[T] = object
I think it boils down to me being used to use "binary" libraries in Java. When
something goes wrong in that case, you can't really tell what happens without
logging (unless you can reproduce it in a debugger). OTOH, Nim's "libraries"
are (AFAIK) mostly available in source form, so one can easily
Alright. I understand. Thank you for your help!
Should be just fine.
Also, you code can potentially benefit from a shortcut inside a proc:
template d: auto = heap.data
Correct!!
To the great comment in the version the play list
[http://pscodes.net](http://pscodes.net) to the how to get free psn codes any
thing the play online game.
That is a real game so far the
[http://stmkeyscodes.net](http://stmkeyscodes.net) great comment in the page.
To the best thing the play online game is
[https://texttwist.online](https://texttwist.online) so more the chance to the
great.
To the generator the homepage the move star planet
[http://mahjongdimensions.me](http://mahjongdimensions.me) game is so more the
free mahjong dimensions online game.
It is so much the comment in the fast to learn this page to
[https://passwordwindows10.com](https://passwordwindows10.com) the improve the
remove password windows 10 site is new version the play list.
14 matches
Mail list logo