samfunc.js revision 67:5c2ed5d89524
1141104Sharti/*
294589Sobrien * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
394589Sobrien *
45814Sjkh * Redistribution and use in source and binary forms, with or without
51590Srgrimes * modification, are permitted provided that the following conditions
61590Srgrimes * are met:
71590Srgrimes *
81590Srgrimes *   - Redistributions of source code must retain the above copyright
91590Srgrimes *     notice, this list of conditions and the following disclaimer.
101590Srgrimes *
111590Srgrimes *   - Redistributions in binary form must reproduce the above copyright
121590Srgrimes *     notice, this list of conditions and the following disclaimer in the
131590Srgrimes *     documentation and/or other materials provided with the distribution.
141590Srgrimes *
151590Srgrimes *   - Neither the name of Oracle nor the names of its
161590Srgrimes *     contributors may be used to endorse or promote products derived
171590Srgrimes *     from this software without specific prior written permission.
181590Srgrimes *
191590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
201590Srgrimes * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
211590Srgrimes * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221590Srgrimes * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
231590Srgrimes * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
241590Srgrimes * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
251590Srgrimes * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
261590Srgrimes * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
271590Srgrimes * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
281590Srgrimes * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
291590Srgrimes * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
301590Srgrimes */
311590Srgrimes
321590Srgrimesfunction func() {
331590Srgrimes     print("I am func!");
341590Srgrimes}
351590Srgrimes
361590Srgrimes// pass script function for java.lang.Runnable argument
371590Srgrimesvar th = new java.lang.Thread(func);
3862833Swsanchezth.start();
3962833Swsanchezth.join();
401590Srgrimes