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

Alexey Baranov pistoletik at gmail.com
Wed Sep 7 15:40:14 UTC 2016


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