Results 1 to 5 of 5

Thread: Critical region

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148

    Critical region

    I have a number of threads that may call a single function, but I want to protect this function with a critical region such that if one thread is in the function all the others must wait for access.

    Any ideas?

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    SyncLock Me
    'Code in here
    End SyncLock

    ????
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148
    Even easier than that it seems - just put System.Runtime.CompilerServices.MethodImplAttribute attribute on the function signature and specify Synchronised...sweet.

  4. #4
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Hey by the way, I'm interested in trying your EventVB thingy but the Overview page:

    http://www.merrioncomputing.com/EventVB/Overview.htm

    ...seems to be busted. edit: aha there's the rest of the docs!

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2002
    Location
    Dublin, Ireland
    Posts
    2,148
    The online help is slow and combersome...you'd be as well to download the EventVB.chm compiled help file...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width