void SWNUI::update() { if(mode == M_CONTINUOUS) mode_continuous(); else mode_gesture(); }
/** * locking_reserve - reserve a slot in the buffer for an event. * @rchan: the channel * @slot_len: the length of the slot to reserve * @ts: variable that will receive the time the slot was reserved * @tsc: the timestamp counter associated with time * @err: receives the result flags * @interrupting: if this write is interrupting another, set to non-zero * * Returns pointer to the beginning of the reserved slot, NULL if error. * * The err value contains the result flags and is an ORed combination * of the following: * * RELAY_BUFFER_SWITCH_NONE - no buffer switch occurred * RELAY_EVENT_DISCARD_NONE - event should not be discarded * RELAY_BUFFER_SWITCH - buffer switch occurred * RELAY_EVENT_DISCARD - event should be discarded (all buffers are full) * RELAY_EVENT_TOO_LONG - event won't fit into even an empty buffer */ inline char * locking_reserve(struct rchan *rchan, u32 slot_len, struct timeval *ts, u32 *tsc, int *err, int *interrupting) { u32 buffers_ready; int bytes_written; *err = RELAY_BUFFER_SWITCH_NONE; if (slot_len >= rchan->buf_size) { *err = RELAY_WRITE_DISCARD | RELAY_WRITE_TOO_LONG; return NULL; } if (rchan->initialized == 0) { rchan->initialized = 1; get_timestamp(&rchan->buf_start_time, &rchan->buf_start_tsc, rchan); rchan->unused_bytes[0] = 0; bytes_written = rchan->callbacks->buffer_start( rchan->id, cur_write_pos(rchan), rchan->buf_id, rchan->buf_start_time, rchan->buf_start_tsc, using_tsc(rchan)); cur_write_pos(rchan) += bytes_written; *tsc = get_time_delta(ts, rchan); return cur_write_pos(rchan); } *tsc = get_time_delta(ts, rchan); if (in_progress_event_size(rchan)) { interrupted_pos(rchan) = cur_write_pos(rchan); cur_write_pos(rchan) = in_progress_event_pos(rchan) + in_progress_event_size(rchan) + interrupting_size(rchan); *interrupting = 1; } else { in_progress_event_pos(rchan) = cur_write_pos(rchan); in_progress_event_size(rchan) = slot_len; interrupting_size(rchan) = 0; } if (cur_write_pos(rchan) + slot_len > write_limit(rchan)) { if (atomic_read(&rchan->suspended) == 1) { in_progress_event_pos(rchan) = NULL; in_progress_event_size(rchan) = 0; interrupting_size(rchan) = 0; *err = RELAY_WRITE_DISCARD; return NULL; } buffers_ready = rchan->bufs_produced - rchan->bufs_consumed; if (buffers_ready == rchan->n_bufs - 1) { if (!mode_continuous(rchan)) { atomic_set(&rchan->suspended, 1); in_progress_event_pos(rchan) = NULL; in_progress_event_size(rchan) = 0; interrupting_size(rchan) = 0; get_timestamp(ts, tsc, rchan); switch_buffers(*ts, *tsc, rchan, 0, 0, 1); recalc_time_delta(ts, tsc, rchan); rchan->half_switch = 1; cur_write_pos(rchan) = write_buf_end(rchan) - 1; *err = RELAY_BUFFER_SWITCH | RELAY_WRITE_DISCARD; return NULL; } } get_timestamp(ts, tsc, rchan); switch_buffers(*ts, *tsc, rchan, 0, 0, 0); recalc_time_delta(ts, tsc, rchan); *err = RELAY_BUFFER_SWITCH; } return cur_write_pos(rchan); }