Threading to prevent GUI Freeze

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 4 14:47:29 PST 2016


On 01/04/2016 06:31 AM, TheDGuy wrote:

 > I tried it with "std.concurrency" like this:
 >
 > bool drawCallback(Scoped!Context cr, Widget widget){
 >      writeln("init");
 >      spawn(&render, cr, widget);

The first parameter to render() is Scoped!Context but render() takes a 
Context:

 > void render(Context cr, Widget widget){

Unless there is implicit conversion from Scoped!Context to Context, it 
won't work. Perhaps you need to call an accessor like the following?

     spawn(&render, cr.some_accessor(), widget);

Ali



More information about the Digitalmars-d-learn mailing list