WordPress database error: [INSERT, UPDATE command denied to user '51213-2'@'10.10.20.149' for table 'wp_options']
INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1715237613.2757260799407958984375', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`)


Warning: Cannot modify header information - headers already sent by (output started at /home/lexiqued/www/WordPress/wp-includes/wp-db.php:1502) in /home/lexiqued/www/WordPress/wp-includes/feed-rss2.php on line 8
C++/CX – Jonathan ANTOINE's thoughts http://www.jonathanantoine.com Yet another blog about... Tue, 26 Feb 2013 14:17:05 +0000 en-US hourly 1 https://wordpress.org/?v=5.5.3 C++/CX : How to expose/convert an existing concurrency::task to Windows::Foundation::IAsyncAction^ ? http://www.jonathanantoine.com/2013/02/26/ccx-how-to-exposeconvert-an-existing-concurrencytask-to-windowsfoundationiasyncaction/ Tue, 26 Feb 2013 14:15:58 +0000 http://www.jonathanantoine.com/?p=1302 streamVideoBlobWindows81😮 I am really writing a blog post on C++ ? Yest it seems so :). At this year MVP Summit I discovered how much fun I can have with C++ (and especially C++/Cx in my case) thanks to Simon Ferquel and Bruno Boucard.

concurrency::task are available through the “ppltasks.h” header files and can be considered as the TPL tasks in C#.
One of the first thing I tried to do in a C++ component is to create a concurrency::task, use it and expose it as a IAsyncAction to the other C#/JS component.

I often create components which needs initialization, and to do so I create tasks:

  • It will be executed on another thread
  • The “client” does not have to wait for the initialization to complete if they don’t need the component immediately
  • In all my component internal functions, I can wait for the initialization to finish using continuation, if it’s already initialized, it returns immediately

It’s not possible to expose a PPL concurrency::task as a WinRT IAsyncAction. To create and return an IAsyncAction, you have to use the concurrency::create_async function which internally create a task and wraps it. If the passed lambda returns a type, then the create_async will return a IAsyncOperation (isn’t it wonderful ?). Here is an example :
[cpp]
concurrency::create_async([this](){ /* my job to do in a task /* });
[/cpp]

But in my case, the task is already created. So the only solution I found to this issue is to create a lambda which returns my task and feed the create_async method with it. As the lambda returns a task, the create_async will create a IAsyncAction/Operation which will wait for the completion of the init task too.

[cpp]
Windows::Foundation::IAsyncAction^ YoupiTralala::ForceInitAsync()
{
auto toReturn= concurrency::create_async([this](){ return this->initTask;});
return toReturn;
}
[/cpp]

Interesting links:

Do you know a better way to do this ?

]]>