How to spawn a thread within a GtkD button event handler

Ferhat Kurtulmuş aferust at
Thu Oct 8 16:53:59 UTC 2020

On Thursday, 8 October 2020 at 15:59:15 UTC, Alaindevos wrote:
> Because when the eventhandler takes to much time the 
> application is no longer responsive.
> And even a simple redraw request is not performed before ending 
> of the thread.
> A small and short demo app would nice. Or guideline and 
> direction.

If I understand your situation, you want to modify widgets from a 
spawned thread. You cannot do that, but you should send a 
widget-state-change request to the main thread using Idle class.

import glib.Idle;

void aThreadFun(){
     new Idle(delegate bool(){
         // Modify your widget here. Redraw etc.
         return false;


More information about the Digitalmars-d-learn mailing list