locked
How can I integrate array with PPL?

    Question

  • Hi,

    I am tring to use PPL to implemant metro app's async operation.
    But I found the return type work for primary type and can't return a array to javascript.

    My code is just like this:

    IAsyncOperation<array<unsigned char>^>^ CSourceReader::getVideoSampleAsync()
    {
     auto op = create_async([]() -> array<unsigned char>^ {
      array<unsigned char>^ bmpData;
      return bmpData;
        });

        return op;
    }

    the call stack doesn't into the create_async block;

    But another one:

    IAsyncOperation<int>^ CSourceReader::getDataAsync()
    {
     auto op = create_async([=]() -> int {
      return 10;
        });

        return op;
    }

    Just work fine.

    Does anybody know how can I integrate ppl with the array?
    Thank you~~~

    Eric

     

     

    Thursday, November 24, 2011 8:56 AM

Answers

  • Can you try with a IAsyncOperation<IVectorView<unsigned char>^>^ ?

    I think array should work but I will have to look into it.

    Thanks


    Raman Sharma | Program Manager, Visual C++ | @rasharm_msft

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    Friday, November 25, 2011 6:53 AM

All replies

  • Can you try with a IAsyncOperation<IVectorView<unsigned char>^>^ ?

    I think array should work but I will have to look into it.

    Thanks


    Raman Sharma | Program Manager, Visual C++ | @rasharm_msft

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)
    Friday, November 25, 2011 6:53 AM
  • Thanks, Sharma,

     

    The IVectorView version is work for me.

     

    Eric

    ps:

    1. I am using 

    Windows.Storage.Stream.DataWriter's writeBytes function to dump some raw data result from WinRT Component.

    and this function need array as it's input.

     

    2. Actually, I met similar problem when I use general lambda expression to pass a array data.

    Friday, November 25, 2011 7:54 AM