|
-
Nov 30th, 2006, 07:11 AM
#1
Thread Starter
Hyperactive Member
[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
-
Nov 30th, 2006, 07:14 AM
#2
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.
-
Nov 30th, 2006, 07:56 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|