.net - Yield/Sleep/throttle Another Thread While It Is Executing A Method In An External Library - Specifically Jurassic?
Jun 25, 2012
I am using a .Net JavaScript implementation called Jurassic to run user-controlled scripts within my .Net 4 WPF application coded in VB.Net - C# answers are fine. The script engine runs on its own thread and provides an API for the script to interact with my application. This all works really nicely until a user executes a script that causes an infinite loop and takes out a core of the processor.
[Code]...
The reason I care about keeping the thread alive is because the user who wrote the script and the user who is running it may not be the same, and I want to keep the experience as smooth as possible the the user running the thread. There also might be legitimate situations in which a single JavaScript function would run for a long time and I do not want to kill that, I just want to stop being allowed to hog the resources.
Solutions that involve stopping the thread from slowing down the system but that still show high CPU usage are not preferable because I do not want the user to wrongly feel that the application is resource intensive.
View 1 Replies
ADVERTISEMENT
Sep 29, 2009
Will Visual Basic in Visual Studio 2010 have the YIELD keyword?If not.... Why?
View 1 Replies
May 25, 2010
Currently I'm using System.Threading.Thread.Sleep(5000) to let my app pause/sleep for some time. This works great but I can't open my app anymore when it's sleeping and it uses about 25% of my CPU. I guess there must be a better way to do this. I also tried using a timer but that didn't work out to well for me..
View 5 Replies
Nov 27, 2009
is there anyway to sleep a thread for a "tick". i.e. the tick in StopWatch.ElapsedTick. right now the best i could achieve is this thread.sleep(1). i need it faster
View 13 Replies
Mar 22, 2010
Im trying to do this
[Code]...
But it will just skip to the last status (Label3.Text = "Status: Welcome")
View 7 Replies
Jul 29, 2009
I wanna sleep a second thread of BackgroundWorker. I tried to use Me.Dispatcher.Thread.Sleep(500) in DoWork event, but it fails.
View 3 Replies
Aug 22, 2011
Im having a problem with putting a thread to sleep...
othread.sleep(system.threading.timeout.indefinite)
The error is :"Access of shared member, constant member or enum member or nested type through an instance, qualifying expression will not be evaluated"
The code is:
Code:
Imports System.IO
Imports System.Threading
Public Class In_Process
[code].....
View 5 Replies
Mar 14, 2009
My question is: how to delete a specifically cell in sql datarow from a specifically datatble to insert i have the folowing
Dim AgendaData As New AgendaData AgendaData.TijdDagWeekJaar = TijdDagWeekJaar.Text AgendaData.WeekJaar = WeekJaar.Text AgendaData.JaarMaand = JaarMaand.Text AgendaData.Jaar = Jaar.Text AgendaData.textbox2 = onderwerp1.Text AgendaData.textbox3 = Onderwerp2.Text AgendaData.textbox4 = Onderwerp3.Text AgendaData.textbox5 = Onderwerp4.Text AgendaData.textbox6 = Onderwerp5.Text
[Code]...
View 2 Replies
Oct 1, 2010
im working in a windows app that execute another apps.. writing the name of the app in a text box (i.e firefox.exe) and click enter to run it im using >> (System.Diagnostics.Process.Start(app_name.Text)) to run apps it works fine with me .. but it didnt with some apps like when I write for example ares.exe it says:Win32Exciption was unhandled :The system cannot find the file specified
View 1 Replies
Jan 2, 2012
I recently found this code (provided for third party use on another VB site), however,ll of my attempts to insert it into a class library have failed.I open a new class library and past the code in, and immediately get several errors pertaining to how certain objects can't be found. I find it it is crucial to use this code, unless someone can suggest to me another example of existing code that will do the same thing: make a restricted textbox who imputs can be restricted, that can handle pasting, shortcuts, text property setting, and script-entered text.
Option Strict On
Imports System.ComponentModel
Public Class RestrictedTextBox
[code].....
View 9 Replies
May 5, 2012
[code]I send the Thread via Thread.Sleep to sleep mode when nothing happens here. Does this affect the TCPListener in his work somehow and what happens to an incomming connection while the Thread is in sleep-mode?
View 3 Replies
Apr 5, 2011
Ok so I have been playing with VB.net and brainstorming ways to accomplish launching a thread reliably every 60 seconds reguardless of how long the prior thread took to do it's work. Here is my question. Given the following code:
[Code]...
My assumption for this output would be that the time between each line would have to be exactly 5000 milliseconds plus the time it takes to execute the rest of the loop which could vary given that there could be an unknown delay due to disk IO. My problem is that looking at lines 10 and 11 and subtracting gives me a difference of 4,958 milliseconds. So my question is what the heck is going on there? How is it possible to get a difference of less than 5000 milliseconds when I have told the thread to sleep for 5000 milliseconds before completing the process. What am I missing?
View 5 Replies
Apr 26, 2009
I am trying to learn how to use Thread.Sleep properly as the main problem I am facing when using it is the fact that the window/form on run time would not move until after the sleep time has elapsed. Did I miss something? Below is a short example of what I want to achieve.
[Code]...
View 8 Replies
Jun 23, 2011
In a WinForms environment, I want to wait a specified amount of time before hiding a user control, but I don't want to freeze the entire UI. I can't kick off to another thread because I have to service the UI components on the thread they were created on. What is the cleanest way to do this?
View 2 Replies
May 13, 2012
I have this little application that is using a System.Threading.Thread.Sleep, application runs great but Windows thinks the application is not responding even though it is running.
[Code]...
View 14 Replies
Apr 22, 2012
i have a web browser control, that refreshes pages on a loop after calling a few subs, i need to create a delay in the loop so that the page has a chance to refresh and redisplay before it loops again. i tried the code below, but it seemed to freeze the entire form, elements including, so the web browser didnt refresh before the loop, so how could i create a non form-freezing delay for a loop?
For count = 1 To 20
WebBrowser1.Navigate("URL")
simcheckcheck()
[code].....
View 4 Replies
Mar 13, 2010
i got inside
WebBrowser1_DocumentCompleted sub
the code below
WebBrowser1.Document.GetElementById("form").InvokeMember("click")
Call ProcessNextLine()
when it clicks this button it should load another page(Like log in)
Call ProcessNextLine()
takes next line from txt file (It's url) + navigate
but I want it to wait let the page load before calling "Call ProcessNextLine()" I tried System.Threading.Thread.Sleep not working?
View 12 Replies
Jun 10, 2009
I'm looking for a way to pause my application while in a loop without affecting the users ability to control the application, the sleep thread method makes it seem that the app is frozen.
View 2 Replies
Apr 23, 2010
i'm working on visual basic with an external program and want to lunch this program from visual basic like withe the shell but what i need the most is to make him incorporated into the form means that the executable is lunched within the form included into it in order to make them like one part for the user is there any way to make it with any version of VB or .net or visual studio even the 2010 ?
View 12 Replies
Nov 10, 2011
I have a control thread that starts up a secondary thread and when the secondary thread finishes, the control thread restarts the secondary thread. On this secondary thread, I use a stopwatch to record a thread.sleep event. Is there any reason, under any circumstance, why the stopwatch elapsed millisecond value (499) would be 1ms less than the sleep time (500 ms)This doesn't happen all the time or even a lot, I'm just curious if there is any physical reason for this to happen.
View 1 Replies
Aug 20, 2009
Is there a sleep method in vb.net(2003).
View 5 Replies
Apr 14, 2012
I want to have My.Settings.Delay in seconds not milliseconds adding the 000 for the user. I tried My.Settings.Delay + 0 + 0 + 0. but can't sort how to do this.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim var As Integer
Dim startVal As Integer
[code]....
View 4 Replies
Aug 22, 2009
I cant get System.Threading.Thread.Sleep to work..[code]
View 2 Replies
Jul 20, 2010
The coding that I have a problem with might make people think that I am creating some malware or something stupid. So the project I am doing is associated with iTunes. iTunes allows people to have one library. There is another way, but it is very confusing to some people, and very unreliable. So my project is that I will allow people to have multiple iTunes libraries on one computer. So the problem is this. In order to have an option to choose your library, I gotta make sure that iTunes is not running. So this is the script:
Code:
Private Sub CheckAndCloseiTunes()
retry:
'Custom class that includes the function to safely close iTunes
[CODE]...
So when I use the Threading.Thread.Sleep(2000) code, the form becomes unresponsive.
View 1 Replies
Jul 20, 2010
The coding that I have a problem with might make people think that I am creating some malware. So the project I am doing is associated with iTunes. iTunes allows people to have one library. There is another way, but it is very confusing to some people, and very unreliable. So my project is that I will allow people to have multiple iTunes libraries on one computer. So the problem is this. In order to have an option to choose your library, I gotta make sure that iTunes is not running.
So this is the script:
Private Sub CheckAndCloseiTunes()
retry:
'Custom class that includes the function to safely close iTunes
Dim Processes As Process() = Process.GetProcessesByName("iTunes")
[CODE]...
So when I use the Threading.Thread.Sleep(2000) code, the form becomes unresponsive.
View 4 Replies
Nov 23, 2011
I would like to execute an external program within powerpoint after the presentation has loaded so i can see if its working. In short my overall objective is to execute the external program which will open up the command prompt and use the sendkeys method to sendkeys to command prompt which help it to run a script at the correct time (which is after presentation is loaded).
View 9 Replies
Aug 27, 2011
I am trying to call a method that started on a background thread on the UI thread calling BeginInvoke and passing in a delegate as follows:
Dispatcher.BeginInvoke(Function() UpdateApplicationDataUI())
to call this method:
Private Sub UpdateApplicationDataUI()
...
End Sub
However, I get an error in the call to BeginInvoke (the UpdateApplicationDataUI portion of the delegate is stating "Expression does not produce a value").
Me.Dispatcher.BeginInvoke(Function() New Action(AddressOf UpdateApplicationDataUI))
View 1 Replies
Aug 5, 2009
I have a GUI which executes on the GUI-thread. Further I have another thrad which does video processing using DirectShow (this is COM).
- Now I want to execute a function on the same thread as where the videoprocessing is executing. This is initiated by the GUI-thread. Touching the COM-referenced object goes wrong if a execute the function from another thread (I understand that). When a call the function from the same thread everything goes fine. But to do this I have the poll some flag-bits in the mainloop, and that is not a 'pretty' solution...
All discussions on the internet are about how change the GUI from a different thread.
I have tried several things:
1) Invoke the function using a delegate. This doesn't wordt, since the function is executed in the GUI thread. (checked bu ThreadID's)
2) BeginInvoke the function using a delegate. May be .net executes the function in a original thread where the object has been created. This does also not work: .net used random threads (probaby from the threadpool)
3) ISynchronizeInvoke, Threading.SynchronizationContext and some other features seems only to work on the GUI thread only...
The question: Is there a way to Post, Send of Invoke a delegate on the specific thread (for example by a reference to this thread or threadID)
View 12 Replies
Dec 28, 2009
how to get the name of the currently executing method? I was thinking it was somewhere under My.Application, but I can't find it...
View 4 Replies
Dec 20, 2011
I have a .net class library that works fine. This library has a reference to en external dll. I have converted all its class to comclasses and checked the com interopt checkbox in order to use it as com library. I also registered it with regasm.
[Code]...
View 5 Replies