kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #22371
Re: KiCad Coroutines
-
To:
Torsten Hüter <torstenhtr@xxxxxx>, KiCad Mailinglist <kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
Maciej Sumiński <maciej.suminski@xxxxxxx>
-
Date:
Thu, 7 Jan 2016 12:06:08 +0100
-
Authentication-results:
spf=pass (sender IP is 188.184.36.48) smtp.mailfrom=cern.ch; lists.launchpad.net; dkim=none (message not signed) header.d=none;lists.launchpad.net; dmarc=bestguesspass action=none header.from=cern.ch;
-
In-reply-to:
<trinity-fe1d3c67-55cb-4558-af06-d4d24c1eff05-1452163164735@3capp-gmx-bs15>
-
Spamdiagnosticmetadata:
NSPM
-
Spamdiagnosticoutput:
1:23
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
On 01/07/2016 11:39 AM, "Torsten Hüter" wrote:
> Hi Wayne,
>
> this is of course right, but the idea would be to emulate cooperative multitasking with threads. This is done by synchronizing the threads with condition variables and mutexes. The principle can be found in the articles [1] or [2].
>
> The idea is good, BUT after further research I'd say that there are two show stoppers:
>
> (a) it's not recommended to use secondary threads to call GUI functions
>
> http://docs.wxwidgets.org/trunk/overview_thread.html
>
> (b) the OpenGL context is only valid for the current thread, it's required to change the context for every thread
>
> https://www.opengl.org/wiki/OpenGL_and_multithreading
>
> Ideally rendering and gui handling should happen only in the main thread; but that would be to restrictive for our purposes.
>
> This makes threads in my opinion unattractive for coroutines.
Tools in the Tool Framework never directly interact with OpenGL context.
Even if they request some redrawing/refreshing, it happens in OnPaint
(or similar) event handler.
Regards,
Orson
> --
>
> Yes, state machines or stackless coroutines are possible too, but then the tool-framework code has to be changed a lot. I'll evaluate the other options first. Setjmp/longjmp could work also, but here is stack handling the major issue.
>
> Thanks,
> Torsten
Attachment:
signature.asc
Description: OpenPGP digital signature
Follow ups
References