The pjvm->timeslice_expired flag is set by the periodic SIGALRM herein and tested in the JVM virtual instruction inner loop to decide when a thread has finished using its time slice.
function flag value meaning -------- ---------- ------- timeslice_init() set rfalse initial value timeslice_tick() set rtrue time slice finished jvm_run() rfalse keep running this slice rtrue time slice finished
Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
Definition in file timeslice.c.
#include "arch.h"
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#include <thread.h>
#include "jvmcfg.h"
#include "classfile.h"
#include "jvm.h"
#include "exit.h"
#include "util.h"
Go to the source code of this file.
Defines | |
#define | _REENTRANT |
Functions | |
static void | timeslice_c_dummy (void) |
jlong | timeslice_get_thread_sleeptime (jvm_thread_index thridx) |
Retrieve a thread's sleeptime value safely during read of that variable on a given thread. | |
rvoid | timeslice_init () |
Start the time slicing mechanism at JVM init time. | |
void * | timeslice_run (void *dummy) |
Interval timer thread. | |
rvoid | timeslice_shutdown (rvoid) |
Shut down the time slicing mechanism for JVM shutdown. | |
static void | timeslice_tick () |
Interval timer handler for the signal(SIGALRM) event. | |
Variables | |
static pthread_t | posix_thread_id |
Thread control structure for use by pthread_create(3), etc. | |
static char * | timeslice_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/timeslice.c $ $Id: timeslice.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." |
static struct itimerval | timeslice_period |
Length of time slice interval as used by setitimer(2). |
|
Definition at line 62 of file timeslice.c. |
|
Definition at line 56 of file timeslice.c. |
|
Start the time slicing mechanism at JVM init time. Parameters: rvoid
Definition at line 89 of file timeslice.c. References exit_jvm(), EXIT_TIMESLICE_START, jvm_timeslice_initialized, pjvm, posix_thread_id, rfalse, rnull, rtrue, rjvm::sleeplock, sysErrMsg(), rjvm::timeslice_expired, and timeslice_run(). |
|
Retrieve a thread's sleeptime value safely during read of that variable on a given thread.
Definition at line 133 of file timeslice.c. References pjvm, rjvm::sleeplock, and THREAD. Referenced by threadutil_update_wait(). |
|
Interval timer handler for the signal(SIGALRM) event. Parameters: rvoid
Definition at line 187 of file timeslice.c. References DML9, JVMCFG_TIMESLICE_DEBUG_REPORT_MIN_SECONDS, pjvm, rtrue, sysDbgMsg(), threadutil_update_sleeptime_interval(), rjvm::timeslice_expired, and timeslice_period. Referenced by timeslice_run(). |
|
Interval timer thread.
Definition at line 230 of file timeslice.c. References exit_jvm(), EXIT_TIMESLICE_START, JVMCFG_TIMESLICE_PERIOD_ENABLE, JVMCFG_TIMESLICE_PERIOD_MICROSECONDS, JVMCFG_TIMESLICE_PERIOD_SECONDS, rnull, rtrue, sysErrMsg(), timeslice_period, and timeslice_tick(). Referenced by timeslice_init(). |
|
Shut down the time slicing mechanism for JVM shutdown. Parameters: rvoid
Definition at line 295 of file timeslice.c. References jvm_timeslice_initialized, posix_thread_id, and rfalse. |
|
Definition at line 56 of file timeslice.c. |
|
Thread control structure for use by
Definition at line 77 of file timeslice.c. Referenced by timeslice_init(), and timeslice_shutdown(). |
|
Length of time slice interval as used by
Definition at line 155 of file timeslice.c. Referenced by timeslice_run(), and timeslice_tick(). |