| 1001 | unsigned int __stdcall fxRunFileThread(void* it) |
| 1002 | #else |
| 1003 | void* fxRunFileThread(void* it) |
| 1004 | #endif |
| 1005 | { |
| 1006 | txPool* pool = it; |
| 1007 | txContext* context; |
| 1008 | for (;;) { |
| 1009 | fxLockMutex(&(pool->countMutex)); |
| 1010 | while (pool->count == 0) |
| 1011 | fxSleepCondition(&(pool->countCondition), &(pool->countMutex)); |
| 1012 | if (pool->count > 0) { |
| 1013 | context = pool->firstContext; |
| 1014 | pool->firstContext = context->next; |
| 1015 | pool->count--; |
| 1016 | fxWakeAllCondition(&(pool->countCondition)); |
| 1017 | fxUnlockMutex(&(pool->countMutex)); |
| 1018 | |
| 1019 | fxRunContext(pool, context); |
| 1020 | c_free(context); |
| 1021 | } |
| 1022 | else if (pool->count < 0) { |
| 1023 | fxUnlockMutex(&(pool->countMutex)); |
| 1024 | break; |
| 1025 | } |
| 1026 | } |
| 1027 | #if mxWindows |
| 1028 | return 0; |
| 1029 | #else |
| 1030 | return NULL; |
| 1031 | #endif |
| 1032 | } |
| 1033 | |
| 1034 | void fxRunContext(txPool* pool, txContext* context) |
| 1035 | { |
nothing calls this directly
no test coverage detected