Re: How to create, destroy, and recreate threads

2017-03-27 Thread cheatfate
@cdunn2001, Thread[] variable was not reusable until [https://github.com/nim-lang/Nim/pull/5585](https://github.com/nim-lang/Nim/pull/5585). So, to run your code and see expected results, please update your Nim to current devel version.

Re: How to create, destroy, and recreate threads

2017-03-27 Thread Jehan
The code doesn't hang for me (either on macOS or Linux), and I can't immediately see why it would from looking at the code in `system/threads.nim`. Reusing a thread that is still running would obviously be a recipe for disaster, but that does not seem to be happening.

Re: How to create, destroy, and recreate threads

2017-03-27 Thread Stefan_Salewski
> I haven't been able to cause fragmentation Are you sure that var x = newStringOfCap(10*(11-i)) is really contained in the executable? Well maybe with -O0, but maybe Nim compiler already removes it?

Re: How to create, destroy, and recreate threads

2017-03-27 Thread cdunn2001
Interesting. I got it working by moving `newSeq(threads, 4)` into `cycle()`. I guess once a thread has finished running, simply releasing the `Thread[]` object to GC is the way to destroy it. They are apparently not re-usable. I haven't been able to cause fragmentation after thread destruction,

How to create, destroy, and recreate threads

2017-03-27 Thread cdunn2001
I am trying to test memory fragmentation after thread destruction, but I don't know how to destroy threads properly. What is wrong with this program? import os var threads: seq[Thread[int]] proc wait(s: int) = for i in 0..10: var x = newStringOfCap(10

Re: cannot assign result of a template with block argument unless surrounded by a block expression

2017-03-27 Thread evacchi
> Is it possible to return value from template which the last of argument is > untyped? pretty sure you can: [https://nim-lang.org/docs/manual.html#templates](https://nim-lang.org/docs/manual.html#templates)

Re: Nim version of

2017-03-27 Thread def
Yeah, that looks wrong, I guess I was just playing around.

Re: Thread-local persistence

2017-03-27 Thread cdunn2001
@araq: > and after the thread dies, everything is freed. That's really the problem. I am using `threadpool`, which creates 48 threads when the program starts. Limiting the number of threads seems to cause some to die after usage, but I don't understand what that code is doing. Are you suggesti

Re: Nim version of

2017-03-27 Thread cdunn2001
@def, I'm curious about your example here: [https://github.com/def-/nim-unsorted/blob/master/wcl.nim](https://github.com/def-/nim-unsorted/blob/master/wcl.nim) When you cast to `string` with var size = 4096 buf = cast[ptr string](alloc0(size)) Doesn't a `string` h

Re: FRAG - Framework for Rather Awesome Games

2017-03-27 Thread Krux02
I mean I also have my project in that direction: [https://github.com/krux02/opengl-sandbox](https://github.com/krux02/opengl-sandbox) But I think we have different goals in mind. I try to provide a toolset that allows to write arbitrary custom rendering pipelines quickly for arbitrary data. In

Re: Problem with the generic of sequence.

2017-03-27 Thread slangmgh
Thank you for clarification.

Re: FRAG - Framework for Rather Awesome Games

2017-03-27 Thread carterza
We're certainly not trying to start any wars with anyone, however FRAG does offer some features Nimgame2 does not, with the added cost of complexity. If you have any questions - until we get our own website going - please feel free to ask here or in the project's gitter. Thank you for checking