Strange race condition on Windows

2024-04-06 Thread Araq
> Even this example, without any ref, does not work: ... This example is supposed to work and does when you disable Nim's broken default allocator. That is a regression with the 2.0 line. You really need `-d:useMalloc` for the time being, sorry. I've "fixed" this bug months ago but it causes ot

Strange race condition on Windows

2024-04-06 Thread sls1005
In the code example at [the thread @brainproxy mentioned](https://forum.nim-lang.org/t/11203) are some problems that make it unsafe, including: * In the thread, a _variable_ of a `ref` type is created and assigned to, which increases the reference count by one. As "increasing the reference co

How to customize a top-level Pragma

2024-04-06 Thread Niminem
I think this is what you're looking for: import std/macros macro decorator(procedure: untyped): untyped = expectKind(procedure, nnkProcDef) # 1. ensure macro accepts only procedures procedure[^1].add( # 2. modify the procedure body in some way quo

situation with GDB debugging?

2024-04-06 Thread janAkali
First, see [semi-official guide on Nim debugging](https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html#debugging-nim-code). Also this is an excellent guide: `start` doesn't work as you'd expect because

Trying to get "interfaced" to run with latest nim

2024-04-06 Thread ElegantBeef
> Error: internal error: environment misses: this Likely means you're emitting a `symbol` in a place that it should be an `ident`. I have not taken a look at trying to fix it but properly desyming the typed ast will likely solve it. Otherwise I can suggest a

Strange race condition on Windows

2024-04-06 Thread vanyle
Using `-d:useMalloc` fixes this, but once again, why? What is the default memory allocator for Nim if not malloc? When looking at the source code, I cannot find the difference between `allocShared` and `alloc`, is there one? There is so much documentation missing and even browsing at the source

Strange race condition on Windows

2024-04-06 Thread vanyle
The example with the global string `s` still crashes with `--mm:atomicArc`. But even without it, if a modification of an integer (like a reference count) is only done when a mutex is locked, it should make it atomic? Or the destuctors are called outside the lock sections?

Strange race condition on Windows

2024-04-06 Thread vanyle
If there was no lock, this explanation would make sense, but in my code, the variable access happens behind a lock, so why would there be non-atomic writes

Strange race condition on Windows

2024-04-06 Thread brainproxy
There being a lock in place does not impact/resolve the problem of Nim’s reference counting not being atomic (unless using `--mm:atomicArc`).

Strange race condition on Windows

2024-04-06 Thread vanyle
The more I try things, the more I'm confused. Even this example, without any ref, does not work: import locks import os var s: string var c: int var l: Lock proc myFunc() {.thread.} = for i in 0..<50: os.sleep(1) {.gcsafe.

Strange race condition on Windows

2024-04-06 Thread brainproxy
The reference counting for ARC/ORC is not atomic and therefore problematic for multiple threads. See this similar discussion and note there is an experimental `--mm:atomicArc`:

situation with GDB debugging?

2024-04-06 Thread mszs
It hadn't occurred to me before to try setting the breakpoint explicitly to a line (e.g. line 2) and then to `run` the program in the debugger: well, that does what one expects. So, possibly it's only the `start` command that's not operating as expected. I'd be happy if it's just that: I can liv

Issues while signing up to the forum

2024-04-06 Thread ShishAgain
Trying to post a message to the forum, apparently I already have an account - but I can't post the message because my email isn't confirmed... So I go to my settings, I can see that the email address is set there, and is in an unconfirmed state... but there is no "please send me a fresh confirma

Strange race condition on Windows

2024-04-06 Thread vanyle
Moreover, using `Lockers` without `spawn` does not work: import malebolgia / lockers type Example = object s: string c: int proc threadFunc(lockedObj: Locker[Example]) {.thread.} = lock lockedObj as obj: obj.s.add($obj.c)

Strange race condition on Windows

2024-04-06 Thread vanyle
I was interested in implementing a library like malbolgia myself, I'll look at the source code, the locker implementation is what I need. The following works: import malebolgia import malebolgia / lockers type Example = object s: string c: int p

situation with GDB debugging?

2024-04-06 Thread mszs
I'm having problems with debugging. Not sure whether it's just me... When I compile for debugging and I load the resulting executable into nim-gdb, the symbol table seems off. I've tried this with 2.0.2 as well as 1.6.18. The location for the main function/program entry point is not the same in

How to install nim 2.0.2 on arm64?

2024-04-06 Thread ShishAgain
Goal: Have a docker container which contains nim 2.0.2, which can be built both on arm and x86 * choosenim doesn't seem to support arm * nim-lang.org doesn't have arm downloads * the github nightlies repo has arm, but only seems to have unstable builds so I decide to try building from so

Strange race condition on Windows

2024-04-06 Thread jrfondren
Mastering Nim has a malbolgia example that does what you're attempting here with [lockers](https://github.com/Araq/malebolgia?tab=readme-ov-file#lockers), and has this warning: > A `ref T` pointer is implemented with reference counting and based on the > lifetime-tracking hooks. For performance

Strange race condition on Windows

2024-04-06 Thread vanyle
How can I share memory between threads? Do I have to use pointers with allocShared and manual memory manager? Do pointer with alloc work ? Is there documentation somewhere about this?

CBD Oil Chemist Warehouse: Your Trusted Source for Wellness

2024-04-06 Thread nfwxsle
CBD Oil Chemist Warehouse: Your Trusted Source for Wellness CBD Oil Chemist Warehouse emerges as major areas of strength for an adaptable decision. Isolated from the hemp plant, this oil has been making noteworthy buzz on account of its possible prosperity and medical advantages. Note :- This Of

CBD Oil Chemist Warehouse: Experience Relief Naturally Selection

2024-04-06 Thread nfwxsle
CBD Oil Chemist Warehouse: Experience Relief Naturally Selection Understanding CBD Oil Hemp oil is removed from the seeds of the hemp plant and contains a rich profile of enhancements, including principal unsaturated fats, supplements, and minerals. Note :- This Offer IS Available Only In Austra

Strange race condition on Windows

2024-04-06 Thread Araq
`Thread[Example]` is not supported since you use a `ref`.

Strange race condition on Windows

2024-04-06 Thread vanyle
By adding an `echo` inside `threadFunc`, I can get it to crash every time: proc threadFunc(obj: Example) {.thread.} = withLock lock: echo "Inside thread" obj.s.add($obj.c) inc obj.c Run Once again, this only occurs on windows.

Strange race condition on Windows

2024-04-06 Thread vanyle
I wanted to add more examples to as I feel that some modules lack documentation. I wrote a small program to show how to share memory between threads in Nim: import locks type Example = ref object s: string c: int

Trying to get "interfaced" to run with latest nim

2024-04-06 Thread sei
Hi y'all! I'm trying to get the macros to work with the latest nim devel version. I got rid of the deprecation warnings and replaced all "RootRef" with "pointer" as suggested here: The modified fork i

Help needed: binarylang issue

2024-04-06 Thread soarowl
Thanks your respond, I turn to Elixir to write my parsers.

What Are The Best Results Of Using BioXTrim Gummies?

2024-04-06 Thread bioxtrimuse
It's normal to make 2 BioXTrim Gummies holders stroll around the step, one going before breakfast and the other before dinner, with a titanic store of water, for on any event day. The improvement will start working from the central multi-day stretch obviously, uncovering huge weight decline resu

GutOptim Reviews With Acid Reflux Issues|| Price, Benefits

2024-04-06 Thread bioxtrimuseu
GutOptim works since it targets low pepsinogen levels. As indicated by a new examination referred to by the creators of GutOptim, low pepsinogen levels are the main driver of normal stomach-related wellbeing concerns - like swelling, queasiness, and acid reflux. In particular, pepsinogen is a st

Help needed: binarylang issue

2024-04-06 Thread PMunch
I agree that 1 is a bug, but 2 is really just a design choice. Since Nim doesn't have a 7 bit datatype both binaryparse and binarylang has decided to use the smallest data type which can fit a field, in this case an 8 bit integer. They also both returns tuples which makes the macro generation s

How to customize a top-level Pragma

2024-04-06 Thread demotomohiro
https://internet-of-tomohiro.pages.dev/nim/faq.en#coding-can-i-define-custom-pragmasqmark