none
Syntax Volatile's Benefit? RRS feed

  • Question

  • Hello,

    1.
    What is the purpose to use syntax volatile in business context? Any concrete example?
    What benefit can you use the syntax volatile?


    2.
    https://www.c-sharpcorner.com/UploadFile/1d42da/volatile-keyword-in-C-Sharp-threading/
    "The volatile keyword is a convenience keyword for those who need to access member variables of a class or structure in multi-threaded conditions."

    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/volatile
    "The volatile keyword indicates that a field might be modified by multiple threads that are executing at the same time. "

    If you don't use syntax volatile. How would it be then? Chronological order in all thread without taking account to prioritization?


    Thank you!

    Friday, June 28, 2019 7:15 AM

All replies

  • Hi Saura,

    Thank you for posting here.

    Based on your description, you want to the benefits of using Volatile.

    The following links describe that the advantages of Volatile and when to use it.

    https://www.infoworld.com/article/3229360/how-to-use-the-volatile-keyword-in-c.html

    https://stackoverflow.com/questions/1701216/is-there-any-advantage-of-using-volatile-keyword-in-contrast-to-use-the-interloc

    Note:This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, June 28, 2019 9:50 AM
    Moderator