|
// ----------------------------------------------------------------------------
//
// Func: Morpho_Fct_Thread()
//
// ----------------------------------------------------------------------------
static unsigned __stdcall Morpho_Fct_Thread( void *pvoid )
{
SliceO_Window *window = ((Struct_Dispatch_2 *) pvoid)->window ;
SliceO_Frame *frame = ((Struct_Dispatch_2 *) pvoid)->frame ;
void *progress = ((Struct_Dispatch_2 *) pvoid)->progress ;
Error_Fct( hwnd, ERROR_CODE_TRACE_3, "in Morpho_Fct_Thread()" ) ;
if ( Progress_Abort( progress ) )
goto abort ;
// --- if image is locked: skip ---
if ( frame->Lock_Get() ) {
Error_Fct( hwnd, ERROR_CODE_WARNING, "\xF1\005WARNING:\002 image locked!" ) ;
Error_Fct( hwnd, ERROR_CODE_WARNING, "\xF1\t skipping: \001%s", frame->Name_Get() ) ;
Progress_Write( progress, "\xF1\005WARNING:\xF0\002 image locked!" ) ;
Progress_Write( progress, "\002 skipping: \001%s", frame->Name_Get() ) ;
goto exit ;
}
// --- Place a lock on this frame ---
frame->Lock_Set( 1 ) ;
// --- highlight the frame we are working on ---
frame->Flag_Set_On( CLASS_MODE_THIS, window, CLASS_FLAG_HIGHLIGHT_BLU ) ;
Fct_Redraw( REDRAW_HIGHLIGHT, window, frame ) ;
// ====================================================================
// ==================== Local processing ==============================
// ====================================================================
...
// ====================================================================
// ==================== Cleanup and get out ===========================
// ====================================================================
exit:
// --- unlock the GLI image ---
frame->Lock_Set( -1 ) ;
// --- refresh the graphics ---
Fct_Redraw( REDRAW_DB_STENCIL, window, frame ) ;
abort:
// --- reset the highlight ----
// Note: this is done outside the critical region, it could be dangerous...
frame->Flag_Set_Off( CLASS_MODE_THIS, window, CLASS_FLAG_HIGHLIGHT_BLU ) ;
Fct_Redraw( REDRAW_HIGHLIGHT, window, frame ) ;
// --- signal that we have finished ---
Fct_Dispatch_End() ;
_endthreadex( 1 ) ;
return( 1 ) ;
}
|