title: Async Function in Vala - Yield & Callback
body: <p>I'm developing a project written in Vala and GTK +, I need to implement an asynchronous function, therefore I set out to make an example of test ... and for some reason I get the following error:</p>
  
  <blockquote>
    <p>async.vala:31.3-31.20: error: Access to async callback
    `asyncProc.callback' not allowed in this context      asyncProc.callback
    ();</p>
  </blockquote>
  
  <p>the code is as follows:</p>
  
  <pre><code>using Gtk;
  
  public async void asyncProc ()
  {
      stdout.printf ("STEEP -- 1 --\n");
  
      yield;//Return to Main after the *1
  
      stdout.printf ("STEEP -- 2 --\n");
  }
  
  public static int main (string[] args)
  {
      Gtk.init (ref args);
  
      var win = new Window ();
      win.set_title ("Async Functions Test");
      win.set_default_size (512,100);
      win.set_border_width (12);
  
      win.destroy.connect (Gtk.main_quit);
  
      var boton = new Button.with_label ("  Print in Terminal  ");
  
      //public delegate void AsyncReadyCallback (Object? source_object, AsyncResult res) callback_finalizacion;
  
      boton.clicked.connect (()=&gt; { 
          asyncProc.begin ();
          //--&gt; Return of YIELD
          stdout.printf ("STEEP -- B --\n");
          asyncProc.callback ();
      });
  
      win.add (boton);
      win.show_all ();
  
      Gtk.main ();
      return 0;
  }
  </code></pre>
  
  <p>and compiled using the following command:</p>
  
  <pre><code>valac --pkg gtk+-3.0 --pkg gio-2.0 async.vala
  </code></pre>
  
  <p>Anyone have any idea because it can happen?
  The project I'm developing is as follows: <a href="https://launchpad.net/gcleaner" rel="nofollow">https://launchpad.net/gcleaner</a></p>