From mboxrd@z Thu Jan 1 00:00:00 1970 From: jens.ohlund@secrc.abb.se To: ecos-discuss@sourceware.cygnus.com Subject: Re: [ECOS] Threads and Handles Date: Tue, 04 Jul 2000 23:04:00 -0000 Message-id: X-SW-Source: 2000-07/msg00032.html Hi ! Here's the different parts of the specific thread. Delclarations: #define STACKSIZE ( CYGNUM_HAL_STACK_SIZE_TYPICAL ) static cyg_handle_t threadJVM; static cyg_thread thread_objJVM; static char stackJVM[STACKSIZE+2048]; Creation of thread: cyg_thread_create(8, jvmTask, (cyg_addrword_t) 0, "JVM", (void *)stackJVM, STACKSIZE+2048, &threadJVM, &thread_objJVM); cyg_thread_resume(threadJVM); Deletion of thread: doJVMAgain = FALSE; endJVMLoop = true; while (doJVMAgain == FALSE) cyg_thread_delay(1); while (cyg_thread_delete(threadJVM) == FALSE); This is the code the thread is running: static void jvmTask(CYG_ADDRESS data) { cyg_handle_t jvm_counterH, system_clockH, jvm_alarmH; cyg_alarm jvm_alarm; // Set upp alarm system_clockH = cyg_real_time_clock(); cyg_clock_to_counter(system_clockH, &jvm_counterH); cyg_alarm_create(jvm_counterH, vmTimeSlice_func, (cyg_addrword_t) 0, &jvm_alarmH, &jvm_alarm); // Configure the jvm vmconfig.time_slice = TIME_SLICE; vmconfig.references = 500; vmconfig.strings = 100; vmconfig.threads = THREADS; vmconfig.app_start = bindata; vmconfig.heap_start = jvmHeap; vmconfig.heap_end = jvmHeap + HEAP_SIZE; vmconfig.timers = TIMERS; vmconfig.events = EVENTS_COUNT; vmconfig.ev_counters = jvmEvent_counters; vmconfig.native_tbl = native_tbl; vmconfig.usrNotify = 0; while (doJVMAgain) { endJVMLoop = false; // Wait cyg_thread_suspend(threadJVM); // Initialize alarm // Time is 100 ms between each alarm. 10 ms would be prefered. cyg_alarm_initialize(jvm_alarmH, cyg_current_time()+10, 10); // Start jvm vmStart(&vmconfig); // disable alarm cyg_alarm_disable(jvm_alarmH); } bindataSize = 0; doJVMAgain = true; } endJVMLoop is a variable to control a while loop in the vmStart method. yours Jens ecos-discuss-owner@sourceware.cygnus.com 2000-07-04 17:37 To: jens.ohlund@secrc.abb.se cc: ecos-discuss@sourceware.cygnus.com Subject: Re: [ECOS] Threads and Handles Security Level:? Internal jens.ohlund@secrc.abb.se wrote: > > I have declared a cyg_handle_t, a cyg_thread and a stack as static. > > This thread I start and delete every now and then. Exactly how do you delete it? You may want to read http://sourceware.cygnus.com/ecos/docs-latest/ref/ecos-ref.9.html#pgfId=1088577 Jifl -- Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS Tel: +44 (1223) 728762 "Plan to be spontaneous tomorrow." || These opinions are all my own fault