I have problem understating what are rules for using elxir in multithreaded
applications.
In
http://elixir.ematia.de/trac/wiki/TutorialDivingIn#a8.Moreonsessions
we found:
"Elixir provides a default global contextual (thread-local) session for you to
use,"

Does it mean every thread gets thread local session on which it can safely
operate ?

Yes.


My scenario is to use threads to not block main qt app loop for long time DB operations. I wish I have one default session for use in qt thread (fast
access, GUI updates etc) and few session backgrounds.
1. Can I use same session for all threads ?

Yes, but it will be distinct for all threads. Not one for main & one for *all* workers.

2. If not can I pass elxir Entities abong threads ? Should I "copy"/"assign"
them to thread local session ?

Entities are bound to a session. So by definition of a per-thread- session, you can't.

I'm not 100% sure, but I'd say something like this should work:

entity = from_another_thread()
entity = type(entity).get(entity.id)

Alternatively, you can of course pass class & id as tuples directly & use these to construct the entities in a different thread.

Diez

--
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en.

Reply via email to