Please define threadsafe manner?

E.g. which of these operations is not safe:
The following applied to current implementation of Java3D
(It is not requirement of specification)

When a scenegraph modification is perform Java3D send a message
to another module to perform the action. Message sending is
thread safe so in case as long as two or more thread not
modify the same node it should be fine. (since acess to the
same node is not synchronized)

However some operation required special handling such as
(i) adding/removing canvas from view
(ii) View activeViewPlatform()
(iii) New a Canvas3D in offscreen rendering
(iv) First paint invoke in Canvas3D
(v) Canvas3D removeNotify()/AddNotify() remove
(vi) Canvas3D setView()

When those operation is performed it is better not to
modify the scenegraph structure at the same time by another thread.

1) Adding 2 separate branches at the same time to a live scenegraph at
nodes in the graph which are also in seperate branches.
OK

2) Adding 2 separate branches at the same time to a live scenegraph at
nodes in the graph which are in the same branch.
OK if not adding to the same Node. i.e. for NodeA and NodeB belongs to
same Branch, adding branch to NodeA and NodeB at the same time is fine.

3) Adding 2 separate branches at the same time to a live scenegraph at
the same live  node.

Not thread safe

4) Adding a branch to a node at the same time the branch which this node
is attached to is being set live.
Not thread safe


How is synchronization needed in each of the above cases? E.g. is it
enough in case 3 to synchronize on the node which the two branches are
being added to? Do we have to synchronize on nodes, can we make our own
synchronization object to synchronize on, will it give the same result?
Yes, you can use your own synchronize on node. But do it carefully
as it may introduce deadlock (when it happens press Ctrl-Break to
examine the stack trace)


Are the nodes already used for synchronization internally from Java3D
threads?
Current implementation create a retained node for each node and
synchronized for retained node if necessary.


- Kelvin
----------------
Java 3D Team
Sun Microsystems Inc.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to