示例#1
0
void
os_reportClearApiInfo(void)
{
    os_reportInfo *report;

    report = (os_reportInfo *)os_threadMemGet(OS_THREAD_API_INFO);

    if (report->reportContext) {
        os_free(report->reportContext);
        report->reportContext = NULL;
    }
    if (report->sourceLine) {
        os_free(report->sourceLine);
        report->sourceLine = NULL;
    }
    if (report->callStack) {
        os_free(report->callStack);
        report->callStack = NULL;
    }
    if (report->description) {
        os_free(report->description);
        report->description = NULL;
    }
    os_threadMemFree(OS_THREAD_API_INFO);
}
示例#2
0
void
DJA_UtilityBridge_us_doThreadDetach(
    DLRL_Exception* exception,
    void* userData)
{
    JavaVM *jvm;
    JNIEnv* env;
    jint jresult;

    DLRL_INFO(INF_ENTER);

    assert(exception);

    env = *(JNIEnv**)os_threadMemGet(OS_THREAD_JVM);
    jresult = (*env)->GetJavaVM(env, &jvm);
    if(jresult != 0){
        DLRL_Exception_THROW(exception, DLRL_OUT_OF_MEMORY, "Unable to complete operation. Out of resources.");
    }
    jresult = (*jvm)->DetachCurrentThread(jvm);
    os_threadMemFree(OS_THREAD_JVM);
    if(jresult != 0){
        DLRL_Exception_THROW(exception, DLRL_OUT_OF_MEMORY, "Unable to complete operation. Out of resources.");
    }

    DLRL_Exception_EXIT(exception);
    DLRL_INFO(INF_EXIT);
}
示例#3
0
void
saj_delThreadEnv(
    c_bool value)
{
    if (value) {
        os_threadMemFree(OS_THREAD_JVM);
    }
}
示例#4
0
static void
printThreadMessage(
    const char *context)
{
    char *msg = os_threadMemGet(OS_THREAD_WARNING);
    if (msg) {
        OS_REPORT(OS_ERROR,context,0,msg);
        os_threadMemFree(OS_THREAD_WARNING);
    }
}
示例#5
0
void
saj_listenerDetach(
   void* listener_data)
{   
    JavaVM *jvm;
    JNIEnv* env;
    jint jresult;
    
    env = *(JNIEnv**)os_threadMemGet(OS_THREAD_JVM);
    jresult = (*env)->GetJavaVM(env, &jvm);
    assert(jresult == 0);
    jresult = (*jvm)->DetachCurrentThread(jvm);
    os_threadMemFree(OS_THREAD_JVM);
    assert(jresult == 0);
}
示例#6
0
/** \brief Initialize the thread private memory array
 *
 * \b os_threadMemInit releases the thread private memory array
 *    for the calling thread, the allocated private memory areas
 *    referenced by the array are also freed.
 *
 * pre condition:
 *    os_threadMemKey is initialized
 *
 * post condition:
 *       pthreadMemArray is released
 *    or
 *       an appropriate error report is generated
 */
void
os_threadMemExit(
    void)
{
    os_threadRegisteredPrivMem *pthreadMemArray;
    os_int32 i;

    pthreadMemArray = pthread_getspecific (os_threadMemKey);
    if (pthreadMemArray != NULL) {
        for (i = 0; i < OS_THREAD_MEM_ARRAY_SIZE; i++) {
            if (pthreadMemArray[i].pthreadMem != NULL) {
                os_threadMemFree(i);
            }
        }
        os_free (pthreadMemArray);
        if (pthread_setspecific (os_threadMemKey, NULL) == EINVAL) {
            OS_REPORT (OS_ERROR, "os_threadMemExit", 4, "pthread_setspecific failed with error %d", EINVAL);
        }
    }
}