Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delegate void asyncPayload();
- async void callAsync(asyncPayload func)
- {
- SourceFunc callback = callAsync.callback;
- ThreadFunc<void*> run = () => {
- func();
- Idle.add((owned) callback);
- return null;
- };
- new GLib.Thread<void*>("callAsync", run);
- yield;
- }
- void testFunc(int arg1, string arg2)
- {
- stdout.printf("arg1: %i\n", arg1);
- stdout.printf("arg2: %s\n", arg2);
- }
- void main()
- {
- int testInt = 5;
- string testString = "test-string";
- asyncPayload pl = () => {
- testFunc(testInt, testString);
- };
- callAsync.begin(pl, (obj, res) => { callAsync.end(res); });
- var loop = new MainLoop(null, false);
- loop.run();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement