Results 1 to 3 of 3

Thread: [02/03] Avoid calling a shared function at the same time.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    425

    [02/03] Avoid calling a shared function at the same time.

    Hi,

    I have a shared function which can only be called once if it is called at the same time in a program, it would produce error. How can avoid this?

    thanks

  2. #2
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [02/03] Avoid calling a shared function at the same time.

    A crude solution would be to use a global boolean variable set to false. The function first checks if it is still false then runs and sets it to true. After that it won't execute again.

    -----------
    Edit: I read your question more carefully, set it to true while the functions executes and at the end set it back to false.
    VB 2005, Win Xp Pro sp2

  3. #3
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [02/03] Avoid calling a shared function at the same time.

    How about using a SyncLock object?

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