Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

interaction between callable(threads)  RSS feed

 
sanjey asok
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two threads and both want to share some information without any synchronization,
1)is it possible?
2) if possible,please explain How?

sorry to give less details
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The java tutorial has a part on concurrency (here) which you should read. It covers all the aspects about threading and synchronization.
 
Henry Wong
author
Sheriff
Posts: 23275
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sanjey asok wrote:I have two threads and both want to share some information without any synchronization,
1)is it possible?
2) if possible,please explain How?

sorry to give less details



First, I would recommend getting very comfortable with using threads and synchronization first. Once you get really really comfortable, then you can start learning how to do optimistic locking algorithms.

Lock-less synchronization can get really hairy -- not for the faint of heart.... but... if you want to play around with it, take a look at the java util concurrent atomic classes.

Henry
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!