gotoHomeFree Source CodeModule fthreadsFact SheetEmail us |
Purple Sage Computing Solutions, Inc. |
|
Home --> Free Source Code --> fthreads --> fthreads Usage --> fthreads Events fthreads EventsThis page describes fthreads events.
Introduction to EventsAn event is a synchronization object. An event is analogou to a logical variable which can take only the values true and false. An event may take only the values posted and clear. An event is initialized by declaring an event variable of type event_t, defined in module fthreads, and passing it to event_init(). When initialized its initial state is cleared. Any thread calling event_wait() or event_waitclear() will wait until another thread posts the event by calling event_post() or event_pulse(). An event's statistics may be gathered by event_status(). An event has an event id, which is an integer between one and the maximum number of events declared on the call to fthread_init(). An event's id is returned by event_id(). Event Routinesevent_init()The event_init() routine initializes a new event synchronization object.
interface
subroutine event_init( ev, tm, name, &
trace_v, flag)
type( event_t), intent( out) :: ev
type( team_t), optional, &
intent( in) :: tm
character( len= *), optional, &
intent( in) :: name
type( trace_t), optional, &
intent( inout) :: trace_v
integer, optional, &
intent( out) :: flag
end subroutine event_init
end interface
The event_init() routine returns a type event_t event variable ev. The event is visible to members of optional type team_t team variable tm, or the team of all worker threads. The optional character variable provides a event name. The optional type trace_t variable trace_v and the optional integer variable flag provide tracing and feedback. event_del()The event_del() routine deletes an event synchronization object.
interface
subroutine event_del( ev, trace_v, &
flag)
type( event_t), intent( out) :: ev
type( trace_t), optional, &
intent( inout) :: trace_v
integer, optional, &
intent( out) :: flag
end subroutine event_del
end interface
The event_del() routine deletes a type event_t event variable ev. The optional type trace_t variable trace_v and the optional integer variable flag provide tracing and feedback. event_wait()The event_wait() routine wait until an event synchronization object is posted.
interface
subroutine event_wait( ev, th, &
trace_v, flag)
type( event_t), intent( out) :: ev
type( thread_t), optional, &
intent( in) :: th
type( trace_t), optional, &
intent( inout) :: trace_v
integer, optional, &
intent( out) :: flag
end subroutine event_wait
end interface
The event_wait() routine causes the calling thread to wait while the event specified by the type event_t eventvariable ev is clear until the event is posted. If the optional type thread_t variable th is present, the calling thread will be check for membership in the event's team. The optional type trace_t variable trace_v and the optional integer variable flag provide tracing and feedback. event_waitclear()The event_waitclear() routine waits until an event synchronization object is posted, then clears the event.
interface
subroutine event_waitclear( ev, th, &
trace_v, flag)
type( event_t), intent( out) :: ev
type( thread_t), optional, &
intent( in) :: th
type( trace_t), optional, &
intent( inout) :: trace_v
integer, optional, &
intent( out) :: flag
end subroutine event_waitclear
end interface
The event_waitclear() routine causes the calling thread to wait while the event specified by the type event_t variable ev is clear until the event is posted, then sets the event back to the clear state. If the optional type thread_t variable th is present, the calling thread will be check for membership in the event's team. The optional type trace_t variable trace_v and the optional integer variable flag provide tracing and feedback. event_post()The event_post() routine posts an event synchronization object.
interface
subroutine event_post( ev, th, &
trace_v, flag)
type( event_t), intent( out) :: ev
type( thread_t), optional, &
intent( in) :: th
type( trace_t), optional, &
intent( inout) :: trace_v
integer, optional, &
intent( out) :: flag
end subroutine event_post
end interface
The event_post() routine causes the calling thread to post the event specified by the event_t variable ev. If the optional type thread_t variable th is present, the calling thread will be check for membership in the event's team. The optional type trace_t variable trace_v and the optional integer variable flag provide tracing and feedback. event_pulse()The event_pulse() routine posts an event synchronization object, then clears it.
interface
subroutine event_pulse( ev, th, &
trace_v, flag)
type( event_t), intent( out) :: ev
type( thread_t), optional, &
intent( in) :: th
type( trace_t), optional, &
intent( inout) :: trace_v
integer, optional, &
intent( out) :: flag
end subroutine event_pulse
end interface
The event_pulse() routine causes the calling thread to post the event specified by the type event_t variable ev, then clear it. If the optional type thread_t variable th is present, the calling thread will be check for membership in the event's team. The optional type trace_tvariable trace_v and the optional integer variable flag provide tracing and feedback. event_id()The event_id() return the event id.
interface
integer function event_id( ev)
type( event_t), intent( in) :: ev
end function event_id
end interface
The integer function event_id() returns the event id indicated bythe type event_t variable ev. The event id is a unique positive integer from one through the number of events. event_status()The event_status() routine returns an event's statistics.
interface
subroutine event_status( ev, name, &
waited, cleared, posted, &
trace_v, flag)
type( event_t), intent( in) :: ev
character( len= *), optional, &
intent( out) :: name
integer, optional, &
intent( out) :: waited
integer, optional, &
intent( out) :: cleared
integer, optional, &
intent( out) :: posted
type( trace_t), optional, &
intent( inout) :: trace_v
integer, optional, &
intent( out) :: flag
end subroutine event_status
end interface
The event_status() routine returns the event statistics of the event indicated by type event_t variable ev. The optional character variable name returns the event's name. The optional integer variable waited returns the number of times a thread has waited for the event to become posted. The optional integer cleared returns the number of times a thread has cleared the event. The optional integer posted returns the number of times a thread has posted the event. The optional type trace_t variable trace_v and the optional integer variable flag provide tracing and feedback. Please see our Fact Sheet, or E-mail us for more information. |
|
| Home - Fact Sheet - Free Source Code - Fortran Links - Email us |