David,
I am interested in sources explaining concurrency. Especially in a (network) I/O situation. At this moment I can not define what I need. Therefore some (Internet) literature would be helpful. A short explanation of the different available systems to synchronize with, and in what situations these may be used could be helpfull too.
Maik
If Thread.currentThread() is called from within a Runnable, is the returned Thread the same Thread contains the Runnable or is it the Thread that declared the Runnable?
Maybe some code will help clarify. Given the following code:Final ArrayList<Thread> someThreads = new ArrayList<ArrayList>();
someThreads.add(Thread.currentThread());
Thread someStartedThread = new Thread(
new Runnable() {
public void run() {
someThreads.add(Thread.currentThread());
}
}
);
someStartedThread.start();
someStratedThread.join();
someThreads.add(someStartedThread);
Which two Threads in the someThreads ArrayList are the same: the first two or the second two?
The above example code could also be used to explain order guarantees, like what someThreads would contain if the someStartedThread.join(); line was removed.
You know... after thinking about it I think i know the answer: the last two are the same, because if that Runnable was declared in its own file then that would be the only Thread available to Thread.currentThread() from that context.
Message was edited by:
MutantPlatypus
> I guess what I should have said in the first place is
> I'd like to see questions in the FAQ that answer
> unusual questions, ones that aren't answered
> elsewhere.
:) By definition such questions are not "frequently asked" and so don't belong in the FAQ.
Unusual questions should be asked in the normal forum.
And as I say in the FAQ it isn't meant to be a tutorial. Some questions arise from a basic lack of knowledge of Java and/or threading.