Home Index classes Index static functions Index enumerations Index structure types

{Thread|_of_execution}


CLASS {Thread|_of_execution} , UNTESTED, NATIVE:


The {Thread} class purpose is to provide running code in a separate thread or process totally isolated from other (and from the main) threads. The only data which can be (partially) sharing is the thread object itself. Be sure that threading does not make your application faster in most cases. E.g. you can not use multi-threading to speed up sorting large arrays, or make a lot of calculations with a lot of data. But it is possible to await asynchronous operations.


IMPORT : {NATIVE_Thread} .

INT Handle|_of_thread , READ


BOOL Is_controller|_of_thread , READ


  

FUNCTION Is_main_thread ==> BOOL



FUNCTION Count_threads ==> INT



------------------------------------------------- 'controlling from parent'

   

METHOD Running|_now ==> BOOL



METHOD Run|_thread_return_controller ==> {Thread} , NEW



METHOD Ended|_thread ==> BOOL


BOOL Stopping|_called , READ


BOOL Terminating


  

METHOD Stop|_thread ( BOOL Terminate )



FUNCTION Wait|_until_all_threads_ended (
     
{Thread} A|rray_of_threads [*] ,
     
INT Max|imal_time_milliseconds_0_to_wait_infinite ) ==> BOOL , NATIVE



------------------------------------------------ 'pass objects to {Thread}'

 

METHOD Take|_objects_to_handle (
     
{Object} A|rray_of_objects_passing [*] ,
     
BOOL Together|_with_hard_linked_objects )



---------------------------------------------------------------- 'priority'

   

ENUMERATION {priority} :

        'BACKGROUND' ,

        'LOW|_PRIORITY' ,

        'NORMAL|_PRIORITY' ,

        'HIGH|_PRIORITY' ,

        'HIGHEST|_PRIORITY' .



METHOD Priority ==> {priority}



METHOD Set_priority ( {priority} Value|_to_set )



-------------------------------------------------------- 'exchange objects'

END