Synchronization


Functions

void set_hourglass (bool enable)


Compounds

     struct   FlagThe flag synchronization object (aka Semaphore)
     struct   FlagexSynchronization object that combines FLAG and MutEX (FLAGEX)
     struct   MutexMutex a kind of a synchronization object that provides MUTually EXclusive (MUTEX) access to some part of the code (in some systems this is also known as Resource)


Detailed Description

Synchronization objects are used to synchronize access to shared objects. In many, cases you can use the Mutex structure.


Function Documentation

void set_hourglass ( bool enable )
 

When you start this function, the system starts a special Thread to show the picture, which can eat up to 10-11% of processor time; after you stop it, don't forget to remove it from the screen by repainting it.

Parameters:
enable   TRUE to start the show, FALSE to stop it
Returns:
None
       #include <cywin.h>
       ...
       long obtain_new_value();
       ...
       struct module_t main_module;
       struct Output* ptr_output;
       long current_value;
       long size;
       int index;
       ...
       ptr_output = Archive_open_write_Ex ( main_module.m_process->module->archive,
                                           "data.txt" );
       ...
       size = Output_get_size( ptr_output )/sizeof(long);
       set_hourglass( TRUE );
       for( index = 0; index < size; index++ )
       {
         current_value = obtain_new_value();
         Output_write_dword( ptr_output, current_value );
       }
       set_hourglass( FALSE );
       ...
       Output_dtor( ptr_output, FREE_MEMORY );
       ...