locked
Mutual exclusion in Store app

    Question

  • Hi.

    I have two questions about Mutual exclusion.

    Q1. Is it possible to realize Mutual exclusion between Windows Store apps?

    Named system Mutex is available in Windows Store app.

    So I create two Store apps for test in reference to the document of the following.

    http://msdn.microsoft.com/en-us/library/f55ddskf(v=vs.110).aspx

    But it does not work correctly.

    Please tell me the correct way to implement Mutual exclusion in Windows store app?

    Q2. Is it possible to realize Mutual exclusion between Windows Store app and Desktop app?

    Thanks.

    Wednesday, June 11, 2014 4:44 AM

Answers

  • System mutexes in Store apps are for uncommon cases when there are multiple processes in a single AppContainer.  So, you can't reference a System mutex from both a desktop app and a Store app.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by Pola_m Tuesday, June 17, 2014 1:14 AM
    Monday, June 16, 2014 4:02 PM
    Moderator

All replies

  • What exactly are you trying to do with this Mutex? Store apps run in a sandbox and do not interact with each other.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, June 11, 2014 2:21 PM
    Moderator
  • Hi Matt.

    I'd like to share the file in document library between Store app and Desktop app.

    In order to prevent accessing the file sametime by each app, I try to use Named System Mutex.

    But, in spite of Store app supports Named System Mutex , it does not work.

    please tell me any good idea.

    Thanks.

    Thursday, June 12, 2014 2:49 AM
  • Why do you asking?
    Sunday, June 15, 2014 10:23 AM
  • I'll check to see if this should work. Are you getting an exception or does it just not work at all?


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, June 16, 2014 11:48 AM
    Moderator
  • System mutexes in Store apps are for uncommon cases when there are multiple processes in a single AppContainer.  So, you can't reference a System mutex from both a desktop app and a Store app.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by Pola_m Tuesday, June 17, 2014 1:14 AM
    Monday, June 16, 2014 4:02 PM
    Moderator
  • Also, what's the purpose behind doing single-instance opening of the text file? It's an interesting scenario.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, June 16, 2014 7:47 PM
    Moderator
  • Thanks!
    Tuesday, June 17, 2014 1:14 AM