Jump to content

Recommended Posts

Posted

Can I call Sleep(500); in a UniGui application if I need to add a delay inside a for loop, or do I need use some other UniGui function instead?

 

Posted

I'd use Sleep() for debugging purposes only. You should test whether it hangs the whole server or not (call a long Sleep and open a new connection on a separate window).

Posted

As far as I understand, Unigui is a multithreaded system,

so you can sleep in all spawned threads, that is in uniMainModule

and all forms which run under it.

 

But in the ServerModule it is a different issue, and I would only use

sleep in the OnHTTP events, which probably spawn a new thread.

 

Sleeping elsewhere in the ServerModule will probably halt the server,

in the sense that new threads/connections/sessions may not be started,

but I have not tested this, and also I do not see the point of sleeping

other places, like in Create or the other events.

 

If doing HTTP longpolling, you have to sleep in the OnHTTP events,

to keep the connection.

Posted

Can I call Sleep(500); in a UniGui application if I need to add a delay inside a for loop, or do I need use some other UniGui function instead?

 

The actual question is why do you need a sleep delay inside a loop? If you are waiting for something to "happen" or "catch up" before you can continue then you need to have to look at your design again.

Posted

Once i had to deal with legacy and custom libraries for serial communicaction, so i was forced to use "sleep", just avoid the use of "Application.ProcessMessages".

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...