Funzione EventLoop_RunEventLoop_Run Function
Intestazione: #include <applibs/eventloop.h>Header: #include <applibs/eventloop.h>
Esegue un oggetto EventLoop e invia gli eventi in sospeso nel thread di esecuzione del chiamante.Runs an EventLoop and dispatches pending events in the caller's thread of execution.
EventLoop_Run_Result EventLoop_Run(EventLoop *el, int duration_in_milliseconds,
bool process_one_event);
ParametriParameters
el
Oggetto EventLoop da eseguire.el
The EventLoop to run.duration_in_milliseconds
Intervallo di tempo di esecuzione del ciclo di eventi.duration_in_milliseconds
The length of time to run the event loop. Se il valore è zero, il ciclo eseguirà un solo evento, se è pronto, e si interromperà immediatamente, indipendentemente dal valore del parametroprocess_one_event
.If zero, the loop will process one event if one is ready and break immediately, regardless of the value of theprocess_one_event
parameter. Se il valore è maggiore di zero, il ciclo verrà eseguito per l'intervallo di tempo specificato a meno che non venga interrotto.If greater than zero, the loop will run for the specified duration unless it is interrupted. Se il valore è minore di zero, il ciclo continuerà a essere eseguito fino a quando non viene interrotto.If less than zero, the loop will keep running until interrupted. Per informazioni su altre condizioni, vedere la funzione EventLoop_Stop e il parametroprocess_one_event
.See the EventLoop_Stop function and theprocess_one_event
parameter for additional conditions.process_one_event
Indica se il ciclo viene interrotto dopo l'elaborazione del primo evento.process_one_event
Indicates whether to break the loop after the first event is processed. Se il valore è false, il ciclo continuerà a essere eseguito per la durata specificata dal parametroduration_in_milliseconds
o fino a quando non viene interrotto da EventLoop_Stop.If false, the loop will keep running for the duration specified by theduration_in_milliseconds
parameter, or until it is interrupted by EventLoop_Stop. Seduration_in_milliseconds
è zero, questo parametro viene ignorato.This parameter is ignored ifduration_in_milliseconds
is zero.
Valore restituitoReturn value
Restituisce un valore EventLoop_Run_Result che indica i risultati della chiamata di funzione.Returns an EventLoop_Run_Result value that indicates results of this function call.
OsservazioniRemarks
Un'applicazione può chiamare EventLoop_Run(el, -1, false)
per passare il controllo del thread chiamante a EventLoop
.An application can call EventLoop_Run(el, -1, false)
to pass control of the calling thread to the EventLoop
.
Se l'applicazione chiama EventLoop_Run(el, -1, true)
, il ciclo si bloccherà e rimarrà in attesa del primo evento, quindi elaborerà l'evento e restituirà il risultato.If the application calls EventLoop_Run(el, -1, true)
, the loop will block and wait until the first event is ready, then it will process the event and return.
Un'applicazione può chiamare EventLoop_Stop per anticipare l'uscita da EventLoop_Run
.An application can call EventLoop_Stop to exit EventLoop_Run
earlier.