| 372 | |
| 373 | #if mxAndroid |
| 374 | int ServiceThreadPerform(int fd, int events, void* it) |
| 375 | #elif mxLinux |
| 376 | gboolean ServiceThreadPerform(void* it) |
| 377 | #else |
| 378 | void ServiceThreadPerform(void* it) |
| 379 | #endif |
| 380 | { |
| 381 | ServiceThread thread = it; |
| 382 | ServiceEvent event; |
| 383 | //fprintf(stderr, "ServiceThreadPerform thread %p\n", thread); |
| 384 | #if mxAndroid |
| 385 | txByte msg; |
| 386 | read(fd, &msg, sizeof(msg)); |
| 387 | pthread_mutex_lock(&(thread->mutex)); |
| 388 | #elif mxLinux |
| 389 | g_mutex_lock(&(thread->mutex)); |
| 390 | #elif mxWindows |
| 391 | EnterCriticalSection(&(thread->lock)); |
| 392 | #else |
| 393 | pthread_mutex_lock(&(thread->mutex)); |
| 394 | #endif |
| 395 | event = thread->firstEvent; |
| 396 | thread->firstEvent = NULL; |
| 397 | thread->lastEvent = NULL; |
| 398 | #if mxLinux |
| 399 | g_mutex_unlock(&(thread->mutex)); |
| 400 | #elif mxWindows |
| 401 | LeaveCriticalSection(&(thread->lock)); |
| 402 | #else |
| 403 | pthread_mutex_unlock(&(thread->mutex)); |
| 404 | #endif |
| 405 | while (event) { |
| 406 | ServiceEvent nextEvent = event->nextEvent; |
| 407 | ServiceCallback callback = event->callback; |
| 408 | event->nextEvent = NULL; |
| 409 | event->callback = NULL; |
| 410 | (*callback)(event); |
| 411 | event = nextEvent; |
| 412 | } |
| 413 | #if mxInstrument |
| 414 | fxSampleInstrumentation(thread->the, 0, NULL); |
| 415 | #endif |
| 416 | #if mxAndroid |
| 417 | return 1; |
| 418 | #elif mxLinux |
| 419 | return G_SOURCE_REMOVE; |
| 420 | #endif |
| 421 | } |
| 422 | |
| 423 | void ServiceThreadSignal(ServiceThread client, ServiceThread server, ServiceEvent event) |
| 424 | { |
nothing calls this directly
no test coverage detected