Changeset 120dac7 for global.c


Ignore:
Timestamp:
Aug 8, 2013, 2:38:50 PM (8 years ago)
Author:
Edward Z. Yang <ezyang@mit.edu>
Branches:
master
Children:
ecd4edf
Parents:
a38becd
git-author:
Jason Gross <jgross@mit.edu> (07/21/11 18:17:41)
git-committer:
Edward Z. Yang <ezyang@mit.edu> (08/08/13 14:38:50)
Message:
Added a hook for wakeup/user input.

I wanted to add a hook that got called on all user-input, but any
non-trivial use of that hook incurred too much overhead (about 7 ms per
paragraph for entry into perl, and another 100 ms or so per paragraph
for execution of the hook; tests run on pasting lorem ipusm, on
linerva).

This hook is called at most once a second (approximately).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.c

    r6383920 r120dac7  
    5656  g->starttime=time(NULL); /* assumes we call init only a start time */
    5757  g->lastinputtime=g->starttime;
     58  g->last_wakeup_time = g->starttime;
    5859  g->newmsgproc_pid=0;
    5960 
     
    482483time_t owl_global_get_idletime(const owl_global *g) {
    483484  return(time(NULL)-g->lastinputtime);
     485}
     486
     487void owl_global_wakeup(owl_global *g)
     488{
     489  if (time(NULL) - g->last_wakeup_time >= 1) {
     490    g_free(owl_perlconfig_execute("BarnOwl::Hooks::_wakeup()"));
     491    g->last_wakeup_time = time(NULL);
     492  }
    484493}
    485494
Note: See TracChangeset for help on using the changeset viewer.