All pastes #183624 Raw Edit

Untitled

public c v1 · immutable
#183624 ·published 2006-09-27 01:46 UTC
rendered paste body
// hal_lib fragmentvoid constructor_task(void *data) {    static int i;    while(1) {        rtapi_print_msg(RTAPI_MSG_INFO, "HAL: constructor task running, %p %s\n", hal_data->pending_constructor, hal_data->constructor_prefix);        hal_data->constructor_prefix[0] = 0;        hal_data->pending_constructor = 0;        rtapi_task_pause(rtapi_task_self());    }}.....static void thread_task(void *arg){                   hal_thread_t *thread;    hal_funct_t *funct;    hal_funct_entry_t *funct_root, *funct_entry;    long long int start_time, end_time;    long long int thread_start_time;    thread = arg;    while (1) {        if (hal_data->pending_constructor) {            rtapi_task_resume(hal_data->constructor_task_id);        }..... // halcmd fragment    fprintf(stderr, "Constructing: %s %s\n", comp_name, inst_name);    while(hal_data->pending_constructor) {        fprintf(stderr, "Waiting for pending_constructor to become NULL\n");        struct timespec ts = {0, 100 * 1000 * 1000}; // 100ms        rtapi_mutex_give(&(hal_data->mutex));        nanosleep(&ts, NULL);        rtapi_mutex_get(&(hal_data->mutex));    }    strncpy(hal_data->constructor_prefix, inst_name, HAL_NAME_LEN);    hal_data->constructor_prefix[HAL_NAME_LEN]=0;    hal_data->pending_constructor = comp->make;    rtapi_mutex_give(&(hal_data->mutex));    // rtapi_task_resume(hal_data->constructor_task_id);    while(hal_data->pending_constructor) {        fprintf(stderr, "Waiting for pending_constructor to become NULL (after)\n");        struct timespec ts = {0, 100 * 1000 * 1000}; // 100ms        nanosleep(&ts, NULL);    }