Changeset 840e9b5 for global.c


Ignore:
Timestamp:
Aug 7, 2013, 7:53:31 PM (11 years ago)
Author:
Jason Gross <jgross@mit.edu>
Children:
94eb15b
Parents:
db798a2
git-author:
Jason Gross <jgross@mit.edu> (07/21/11 18:17:41)
git-committer:
Jason Gross <jgross@mit.edu> (08/07/13 19:53:31)
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 r840e9b5  
    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.