Java Question Calling RaiseEventFromDifferentThread multiple times ?

wl

Well-Known Member
Licensed User
Longtime User
Hello,

For my extended POP3 library I'm running code inside my library in an asynchroneous way (runnable).

It downloads a message with the given index (supporting TOP) and calls an event "downloadcompleted" when the message retrieval is finished. The calling of this event is done by RaiseEventFromDifferentThread. The code was based on the Erels code.

I am wondering: what if I modified this code so that all messages will be downloaded in a single run (sort of a loop around previous code) and I would call this same event within each iteration of this loop ?

In this way it would be possible that RaiseEventFromDifferentThread would be called a second time when the first is still running in the foreground thread (especially when the code running in the foreground thread is relatively slow). Do I have a synchronization problem in this way ?

Thanks !
 

wl

Well-Known Member
Licensed User
Longtime User
thanks Erel, that was indeed what I intended to do in the first place, but I was just wondering how exactly RaiseEventFromDifferentThread works.

Are calls being serialized / queued ?

Meaning: when the foreground thread is processing some other code and RaiseEventFromDifferentThread is being called this call will be run as soon as the foreground thread becomes idle ?
 
Top