Start routine: (void *(*)(void*))continuation. Where is the function?

David Holmes david.holmes at oracle.com
Thu Sep 8 07:33:17 UTC 2016


Hi Alexey,

The discuss list is for discussion of the OpenJDK project as a whole, 
not for specific code questions. This question, concerning the launcher, 
should be asked on core-libs-dev at openjdk.java.net.

That said, look for:

     rslt = ContinueInNewThread0(JavaMain, threadStackSize, (void*)&args);

JavaMain is the function executed in the new thread. I can't tell from 
your fragment what version of the code you are looking at.

Regards,
David

On 8/09/2016 1:40 AM, Alexey Baranov wrote:
> Hello,
>
> The function int JLI_Launch, file jdk/src/share/bin/java.c, returns:
> return JVMInit(&ifn, threadStackSize, argc, argv, mode, what, ret);
>
> Further along the call chain: JVMInit -> ContinueInNewThread ->
> ContinueInNewThread0
> we get to functions that I don't understand what's going on))
>
> ///////////////////////////////
> /*
>  * Block current thread and continue execution in a new thread
>  */
> int ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong
> stack_size, void * args) {
>     int rslt;
> #ifndef __solaris__
>     pthread_t tid;
>     pthread_attr_t attr;
>     pthread_attr_init(&attr);
>     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
>
>     if (stack_size > 0) {
>       pthread_attr_setstacksize(&attr, stack_size);
>     }
>
>     if (pthread_create(&tid, &attr, (void *(*)(void*))continuation,
> (void*)args) == 0) {
>       void * tmp;
>       pthread_join(tid, &tmp);
>       rslt = (int)tmp;
> ///////////////////////////////
>
> The new thread starts execution by invoking start routine:
> (void *(*)(void*))continuation
>
> Please tell me where is the function that execution the new thread?
>


More information about the discuss mailing list