public void RunThreadProcess(ref List <byte[]> pixelsListToDo) { // Check that SSE inctructions are avaible. if (isAvaibleSSE() != 1) { throw new NotSSEAvaibleException("Thre is no SSE instructions in your CPU!"); } // Initialize pointers list. foreach (var element in pixelsListToDo) { unsafe { fixed(byte *p = element) { IntPtr ptr = (IntPtr)p; _pointers.Add(ptr); } } } if (!_isAsm) { // TODO: split into two functions for ASM and CPP. for (int i = 0; i < ThreadsNum; i++) { var tmp = new Thread(DoCppJob); _threads.Add(tmp); } foreach (var element in _threads) { element.Start(pixelsListToDo); element.Join(); } } else { // TODO: split into two functions for ASM and CPP. for (int i = 0; i < ThreadsNum; i++) { var tmp = new Thread(DoAsmJob); _threads.Add(tmp); } foreach (var element in _threads) { element.Start(_pointers); element.Join(); } } while (_threadsCompleated != ThreadsNum) { } ProgramEventsSystem.CallImageProcessingClosed(); }
private void ThreadCompleatedHandler() { _threadsCompleated++; if (_threadsCompleated == ThreadsNum) { ProgramEventsSystem.CallImageProcessingClosed(); } }