Showing the changes to codec/common/src/WelsThreadLib.cpp (1 of 120 files). Show all
Unified · Split
| @@ -175,13 +175,13 @@ WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_n · 174 unmodified lines | ||
| 175 | 175 | WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_THREAD_ROUTINE routine, |
| 176 | 176 | void* arg, WELS_THREAD_ATTR attr) { |
| 177 | 177 | #ifdef USE_THREADPOOL |
| 178 | − HANDLE h = CreateEvent(NULL, FALSE, FALSE, NULL); | |
| 178 | + HANDLE h = CreateEvent (NULL, FALSE, FALSE, NULL); | |
| 179 | 179 | HANDLE h2; |
| 180 | − DuplicateHandle(GetCurrentProcess(), h, GetCurrentProcess(), &h2, 0, FALSE, DUPLICATE_SAME_ACCESS); | |
| 181 | − ThreadPool::RunAsync(ref new WorkItemHandler([=](IAsyncAction^) { | |
| 182 | − routine(arg); | |
| 183 | − SetEvent(h2); | |
| 184 | − CloseHandle(h2); | |
| 180 | + DuplicateHandle (GetCurrentProcess(), h, GetCurrentProcess(), &h2, 0, FALSE, DUPLICATE_SAME_ACCESS); | |
| 181 | + ThreadPool::RunAsync (ref new WorkItemHandler ([ = ] (IAsyncAction^) { | |
| 182 | + routine (arg); | |
| 183 | + SetEvent (h2); | |
| 184 | + CloseHandle (h2); | |
| 185 | 185 | }, CallbackContext::Any), WorkItemPriority::Normal, WorkItemOptions::TimeSliced); |
| 186 | 186 | #else |
| 187 | 187 | WELS_THREAD_HANDLE h = CreateThread (NULL, 0, routine, arg, 0, NULL); |
| @@ -265,15 +265,15 @@ WELS_THREAD_ERROR_CODE WelsEventOpen (WELS_EVENT* p_event, const char* event_ · 77 unmodified lines | ||
| 265 | 265 | return WELS_THREAD_ERROR_OK; |
| 266 | 266 | } |
| 267 | 267 | #else |
| 268 | − WELS_EVENT event = (WELS_EVENT) malloc(sizeof(*event)); | |
| 268 | + WELS_EVENT event = (WELS_EVENT) malloc (sizeof (*event)); | |
| 269 | 269 | if (event == NULL) |
| 270 | 270 | return WELS_THREAD_ERROR_GENERAL; |
| 271 | − WELS_THREAD_ERROR_CODE err = sem_init(event, 0, 0); | |
| 271 | + WELS_THREAD_ERROR_CODE err = sem_init (event, 0, 0); | |
| 272 | 272 | if (!err) { |
| 273 | 273 | *p_event = event; |
| 274 | 274 | return err; |
| 275 | 275 | } |
| 276 | − free(event); | |
| 276 | + free (event); | |
| 277 | 277 | return err; |
| 278 | 278 | #endif |
| 279 | 279 | } |
| @@ -285,7 +285,7 @@ WELS_THREAD_ERROR_CODE WelsEventClose (WELS_EVENT* event, const char* event_n · 5 unmodified lines | ||
| 285 | 285 | return err; |
| 286 | 286 | #else |
| 287 | 287 | WELS_THREAD_ERROR_CODE err = sem_destroy (*event); // match with sem_init |
| 288 | − free(*event); | |
| 288 | + free (*event); | |
| 289 | 289 | return err; |
| 290 | 290 | #endif |
| 291 | 291 | } |