|
-
Synchronized
Hi,
I got a question about synchronized. I got a threaded application and I want to lock an array to be shore I'm not trying to update it while using it.
Here is what I do:
public void a() {
synchronized (array) {
//do some stuff
}
}
public void b(Array newArray) {
array = newArray;
}
Does this protect me from not updating the array from function b while using it in function a or do I have to do something more, maybe synchronize function b?
Thanks!
Erik
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks