- Timestamp:
- Mar 25, 2011, 3:46:46 AM (13 years ago)
- Children:
- 0af5f9d
- Parents:
- 87833a8
- git-author:
- David Benjamin <davidben@mit.edu> (02/26/11 14:38:04)
- git-committer:
- David Benjamin <davidben@mit.edu> (03/25/11 03:46:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
global.c
rfafb842 r37d188f 113 113 g->timerlist = NULL; 114 114 g->kill_buffer = NULL; 115 116 g->interrupt_count = 0; 117 g->interrupt_lock = g_mutex_new(); 115 118 } 116 119 … … 930 933 g->kill_buffer = g_strndup(kill, len); 931 934 } 935 936 void owl_global_add_interrupt(owl_global *g) { 937 /* TODO: This can almost certainly be done with atomic 938 * operations. Whatever. */ 939 g_mutex_lock(g->interrupt_lock); 940 g->interrupt_count++; 941 g_mutex_unlock(g->interrupt_lock); 942 } 943 944 bool owl_global_take_interrupt(owl_global *g) { 945 bool ans = false; 946 g_mutex_lock(g->interrupt_lock); 947 if (g->interrupt_count > 0) { 948 ans = true; 949 g->interrupt_count--; 950 } 951 g_mutex_unlock(g->interrupt_lock); 952 return ans; 953 }
Note: See TracChangeset
for help on using the changeset viewer.