@@ -159,14 +159,13 @@ int main(int argc, char *argv[]) {
159
159
160
160
// Start event loop
161
161
GMainContext * main_context = g_main_context_default ();
162
- GMainLoop * main_loop = g_main_loop_new (main_context , FALSE);
162
+ g_main_loop_new (main_context , FALSE);
163
163
164
164
#if mxInstrument
165
165
g_timeout_add_seconds (1 , on_instrumentation_timeout , (void * )the );
166
166
#endif
167
167
168
168
// g_main_loop_run(main_loop);
169
- int testTime = 0 ;
170
169
while (TRUE)
171
170
{
172
171
// Set timer: trigger SIGALRM on timeout
@@ -177,22 +176,13 @@ int main(int argc, char *argv[]) {
177
176
timer .it_interval .tv_usec = 0 ;
178
177
setitimer (ITIMER_REAL , & timer , NULL );
179
178
180
- // Record time before event handling
181
- guint64 start = g_get_monotonic_time ();
182
- // Process one event non-blocking
183
- gboolean processed = g_main_context_iteration (NULL , FALSE);
184
- // Record time after event handling
185
- guint64 end = g_get_monotonic_time ();
179
+ // Process one event blocking
180
+ g_main_context_iteration (NULL , TRUE);
186
181
187
182
// Disable timer
188
183
timer .it_value .tv_sec = 0 ;
189
184
timer .it_value .tv_usec = 0 ;
190
185
setitimer (ITIMER_REAL , & timer , NULL );
191
-
192
- if (processed )
193
- {
194
- // printf("process time: %" G_GUINT64_FORMAT " us\n", end - start);
195
- }
196
186
}
197
187
198
188
xsDeleteMachine (the );
0 commit comments