Mir

Comment 21 for bug 1112195

Revision history for this message
Chris Halse Rogers (raof) wrote :

I quite like the .NET inspired variant described above - where the asynchronous code is something like

******************
void connect_callback(State cookie, void *ctx)
{
  connection = end_connect(cookie);
}

{
  ...
  begin_connect(stuff, bits, callback, NULL);
  ...
}
******************

and the synchronous code is

{
   ...
  connection = connect(stuff, bits);
  ...
}

where the connect() function is simply

connect(Stuff stuff, Bits bits)
{
  cookie = begin_connect(stuff, bits, NULL, NULL);
  return end_connect(cookie);
}