It could occur when the continuations run synchronously, because the native implementaion holds mutex when it calls the callback.
In such situation if any related async method is called, it is going to be blocked.
Thus we need to force the continuations to run asyncronously.
Change-Id: I5aa12733cde352de65bc722ecebd8c6b3f92d55e
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
private async Task ScanFolderAsyncCore(string folderPath, bool recursive, CancellationToken cancellationToken)
{
- var tcs = new TaskCompletionSource<bool>();
+ var tcs = new TaskCompletionSource<bool>(TaskContinuationOptions.RunContinuationsAsynchronously);
using (var cbKeeper = ObjectKeeper.Get(GetScanCompletedCallback(tcs, cancellationToken)))
using (RegisterCancellationAction(tcs, folderPath, cancellationToken))
ValidatePaths(paths);
var pathArray = paths.ToArray();
- var tcs = new TaskCompletionSource<bool>();
+ var tcs = new TaskCompletionSource<bool>(TaskContinuationOptions.RunContinuationsAsynchronously);
Interop.MediaInfo.InsertCompletedCallback callback = (error, _) =>
{
ValidatePaths(paths);
- var tcs = new TaskCompletionSource<bool>();
+ var tcs = new TaskCompletionSource<bool>(TaskContinuationOptions.RunContinuationsAsynchronously);
string[] pathArray = paths.ToArray();
Interop.MediaInfo.InsertBurstShotCompletedCallback callback = (error, _) =>