<commit_before>
result = (^r)[2]

```nim

import threadpool

type
	IntSeq = seq[int]

proc calc_something(): IntSeq =
	result = @[100,200,300]

proc start_nim_threadpool( a:cint, b:cint, s:cstring ): cint {.cdecl, exportc.} =
	var r: FlowVar[ IntSeq ]
	echo(s)
	echo("a:", a)
	echo("b:", b)
	parallel:
		r = spawn calc_something()
	return a+b
```

```rusthon
#backend:c++
import nim

def main():
	nim.main()
	print 'calling nim function'
	s = 'mymessage to nim'
	msg = start_nim_threadpool( 10, 20, cstr(s) )
	print msg<commit_msg>updated nim threadpool example.<commit_after>Nim ThreadPool and Parallel
---------------------------


```nim

import threadpool

type
	IntSeq = seq[int]

proc calc_something(x:int, y:int): IntSeq =
	result = @[x,y,x+y]

proc start_nim_threadpool( a:cint, b:cint ): cint {.cdecl, exportc.} =
	var r: FlowVar[ IntSeq ]
	echo("a:", a)
	echo("b:", b)
	parallel:
		r = spawn calc_something( int(a), int(b) )
	return cast[cint]((^r)[2])

```

Run ThreadPool
--------------

```rusthon
#backend:c++
import nim

def main():
	nim.main()
	print 'starting nim threadpool'
	msg = start_nim_threadpool( 10, 20 )
	print msg
{'fraction_non_alphanumeric': 0.1936897458369851, 'fraction_numerical': 0.016652059596844872, 'mean_word_length': 3.818565400843882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3070632', 'n_tokens_mistral': 482, 'n_tokens_neox': 459, 'n_words': 119}