Search Results

Search found 4272 results on 171 pages for 'processes'.

Page 17/171 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Python - Launch a Long Running Process from a Web App

    - by Greg
    I have a python web application that needs to launch a long running process. The catch is I don't want it to wait around for the process to finish. Just launch and finish. I'm running on windows XP, and the web app is running under IIS (if that matters). So far I tried popen but that didn't seem to work.

    Read the article

  • BackgroundWorker

    - by vdh_ant
    Hi guys I'm working on some code that calls a service. This service call could fail and if it does I want the system to try again until it works or too much time has passed. I am wondering where I am going wrong as the following code doesn't seem to be working correctly... It randomly only does one to four loops... protected virtual void ProcessAsync(object data, int count) { var worker = new BackgroundWorker(); worker.DoWork += (sender, e) => { throw new InvalidOperationException("oh shiznit!"); }; worker.RunWorkerCompleted += (sender, e) => { //If an error occurs we need to tell the data about it if (e.Error != null) { count++; System.Threading.Thread.Sleep(count * 5000); if (count <= 10) { if (count % 5 == 0) this.Logger.Fatal("LOAD ERROR - The system can't load any data", e.Error); else this.Logger.Error("LOAD ERROR - The system can't load any data", e.Error); this.ProcessAsync(data, count); } } }; worker.RunWorkerAsync(); } Cheers Anthony

    Read the article

  • Ideas on implementing threads and cross process communication. - C

    - by Jamie Keeling
    Hello all! I have an application consisting of two windows, one communicates to the other and sends it a struct constaining two integers (In this case two rolls of a dice). I will be using events for the following circumstances: Process a sends data to process b, process b displays data Process a closes, in turn closing process b Process b closes a, in turn closing process a I have noticed that if the second process is constantly waiting for the first process to send data then the program will be just sat waiting, which is where the idea of implementing threads on each process occured. I have already implemented a thread on the first process which currently creates the data to send to the second process and makes it available to the second process. The problem i'm having is that I don't exactly have a lot of experience with threads and events so I'm not sure of the best way to actually implement what I want to do. Following is a small snippet of what I have so far in the producer application; Rolling the dice and sending the data: case IDM_FILE_ROLLDICE: { hDiceRoll = CreateThread( NULL, // lpThreadAttributes (default) 0, // dwStackSize (default) ThreadFunc(hMainWindow), // lpStartAddress NULL, // lpParameter 0, // dwCreationFlags &hDiceID // lpThreadId (returned by function) ); } break; The data being sent to the other process: DWORD WINAPI ThreadFunc(LPVOID passedHandle) { HANDLE hMainHandle = *((HANDLE*)passedHandle); WCHAR buffer[256]; LPCTSTR pBuf; LPVOID lpMsgBuf; LPVOID lpDisplayBuf; struct diceData storage; HANDLE hMapFile; DWORD dw; //Roll dice and store results in variable storage = RollDice(); hMapFile = CreateFileMapping( (HANDLE)0xFFFFFFFF, // use paging file NULL, // default security PAGE_READWRITE, // read/write access 0, // maximum object size (high-order DWORD) BUF_SIZE, // maximum object size (low-order DWORD) szName); // name of mapping object if (hMapFile == NULL) { dw = GetLastError(); MessageBox(hMainHandle,L"Could not create file mapping object",L"Error",MB_OK); return 1; } pBuf = (LPTSTR) MapViewOfFile(hMapFile, // handle to map object FILE_MAP_ALL_ACCESS, // read/write permission 0, 0, BUF_SIZE); if (pBuf == NULL) { MessageBox(hMainHandle,L"Could not map view of file",L"Error",MB_OK); CloseHandle(hMapFile); return 1; } CopyMemory((PVOID)pBuf, &storage, (_tcslen(szMsg) * sizeof(TCHAR))); //_getch(); MessageBox(hMainHandle,L"Completed!",L"Success",MB_OK); UnmapViewOfFile(pBuf); return 0; } I'd like to think I am at least on the right lines, although for some reason when the application finishes creating the thread it hits the return DefWindowProc(hMainWindow, message, wParam, lParam); it crashes saying there's no more source code for the current location. I know there are certain ways to implement things but as I've mentioned I'm not sure if i'm doing this the right way, has anybody else tried to do the same thing? Thanks!

    Read the article

  • ResGen.exe stucks when redirect output

    - by Darqer
    Hello I try to redirect standard output from ResGen.exe. I use following code ProcessStartInfo psi = new ProcessStartInfo( "resxGen.exe" ); psi.CreateNoWindow = true; psi.Arguments = sb.ToString(); psi.UseShellExecute = false; psi.RedirectStandardOutput = true; Process p = Process.Start( psi ); p.WaitForExit(); StreamReader sr = p.StandardOutput; string message = p.StandardOutput.ReadToEnd(); It stuck on p.WaitForExit. When I turn off output stream redirection and do not read StandardOutput it works correctly. What do I do wrong ?

    Read the article

  • C signal parent process from child

    - by Gary
    I'm trying to solve a problem I've got where a child process runs execvp() and needs to let the parent know if it returns. So, after the execvp() returns (because there's been an error), how can I tell the parent that this particular event has happened so it can handle it. There's one method of writing a string of text through the pipe I'm using and then reading that from the parent.. but it seems a bit sloppy. Is there a better way? Thanks!

    Read the article

  • C++ Get Username From Process

    - by modernzombie
    I have a process handle with HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, THE_PROCESS_ID); How can I get the username of the user that is running the process? I am using unmanaged code (no .NET).

    Read the article

  • How can ishow Form in process1 from Form in process2 ?

    - by Al0NE
    Hi I'm trying to show hidden form in process1 from another one was called by : Process.Start(@"F:\MyOtherFormPath\MyOtherForm.exe",this.Handle.ToInt32()); As you can see i passed the handle number of the hidden form ,which i'm calling the "MyOtherForm" from, and i used this number to get a handle and show the hidden form from my "MyOtherForm" like this : Form newFrm = Form.FromHandle(new IntPtr(long.Parse(handleNumberOfMyHiddenForm))); newFrm.show(); But it didn't work, any way to do this . P.S: it didn't throw any exception . thanx in advanced ..

    Read the article

  • Microbenchmark showing process-switching faster than thread-switching; what's wrong?

    - by Yang
    I have two simple microbenchmarks trying to measure thread- and process-switching overheads, but the process-switching overhead. The code is living here, and r1667 is pasted below: https://assorted.svn.sourceforge.net/svnroot/assorted/sandbox/trunk/src/c/process_switch_bench.c // on zs, ~2.1-2.4us/switch #include <stdlib.h> #include <fcntl.h> #include <stdint.h> #include <stdio.h> #include <semaphore.h> #include <unistd.h> #include <sys/wait.h> #include <sys/types.h> #include <sys/time.h> #include <pthread.h> uint32_t COUNTER; pthread_mutex_t LOCK; pthread_mutex_t START; sem_t *s0, *s1, *s2; void * threads ( void * unused ) { // Wait till we may fire away sem_wait(s2); for (;;) { pthread_mutex_lock(&LOCK); pthread_mutex_unlock(&LOCK); COUNTER++; sem_post(s0); sem_wait(s1); } return 0; } int64_t timeInMS () { struct timeval t; gettimeofday(&t, NULL); return ( (int64_t)t.tv_sec * 1000 + (int64_t)t.tv_usec / 1000 ); } int main ( int argc, char ** argv ) { int64_t start; pthread_t t1; pthread_mutex_init(&LOCK, NULL); COUNTER = 0; s0 = sem_open("/s0", O_CREAT, 0022, 0); if (s0 == 0) { perror("sem_open"); exit(1); } s1 = sem_open("/s1", O_CREAT, 0022, 0); if (s1 == 0) { perror("sem_open"); exit(1); } s2 = sem_open("/s2", O_CREAT, 0022, 0); if (s2 == 0) { perror("sem_open"); exit(1); } int x, y, z; sem_getvalue(s0, &x); sem_getvalue(s1, &y); sem_getvalue(s2, &z); printf("%d %d %d\n", x, y, z); pid_t pid = fork(); if (pid) { pthread_create(&t1, NULL, threads, NULL); pthread_detach(t1); // Get start time and fire away start = timeInMS(); sem_post(s2); sem_post(s2); // Wait for about a second sleep(1); // Stop thread pthread_mutex_lock(&LOCK); // Find out how much time has really passed. sleep won't guarantee me that // I sleep exactly one second, I might sleep longer since even after being // woken up, it can take some time before I gain back CPU time. Further // some more time might have passed before I obtained the lock! int64_t time = timeInMS() - start; // Correct the number of thread switches accordingly COUNTER = (uint32_t)(((uint64_t)COUNTER * 2 * 1000) / time); printf("Number of process switches in about one second was %u\n", COUNTER); printf("roughly %f microseconds per switch\n", 1000000.0 / COUNTER); // clean up kill(pid, 9); wait(0); sem_close(s0); sem_close(s1); sem_unlink("/s0"); sem_unlink("/s1"); sem_unlink("/s2"); } else { if (1) { sem_t *t = s0; s0 = s1; s1 = t; } threads(0); // never return } return 0; } https://assorted.svn.sourceforge.net/svnroot/assorted/sandbox/trunk/src/c/thread_switch_bench.c // From <http://stackoverflow.com/questions/304752/how-to-estimate-the-thread-context-switching-overhead> // on zs, ~4-5us/switch; tried making COUNTER updated only by one thread, but no difference #include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <pthread.h> #include <unistd.h> #include <sys/time.h> uint32_t COUNTER; pthread_mutex_t LOCK; pthread_mutex_t START; pthread_cond_t CONDITION; void * threads ( void * unused ) { // Wait till we may fire away pthread_mutex_lock(&START); pthread_mutex_unlock(&START); int first=1; pthread_mutex_lock(&LOCK); // If I'm not the first thread, the other thread is already waiting on // the condition, thus Ihave to wake it up first, otherwise we'll deadlock if (COUNTER > 0) { pthread_cond_signal(&CONDITION); first=0; } for (;;) { if (first) COUNTER++; pthread_cond_wait(&CONDITION, &LOCK); // Always wake up the other thread before processing. The other // thread will not be able to do anything as long as I don't go // back to sleep first. pthread_cond_signal(&CONDITION); } pthread_mutex_unlock(&LOCK); return 0; } int64_t timeInMS () { struct timeval t; gettimeofday(&t, NULL); return ( (int64_t)t.tv_sec * 1000 + (int64_t)t.tv_usec / 1000 ); } int main ( int argc, char ** argv ) { int64_t start; pthread_t t1; pthread_t t2; pthread_mutex_init(&LOCK, NULL); pthread_mutex_init(&START, NULL); pthread_cond_init(&CONDITION, NULL); pthread_mutex_lock(&START); COUNTER = 0; pthread_create(&t1, NULL, threads, NULL); pthread_create(&t2, NULL, threads, NULL); pthread_detach(t1); pthread_detach(t2); // Get start time and fire away start = timeInMS(); pthread_mutex_unlock(&START); // Wait for about a second sleep(1); // Stop both threads pthread_mutex_lock(&LOCK); // Find out how much time has really passed. sleep won't guarantee me that // I sleep exactly one second, I might sleep longer since even after being // woken up, it can take some time before I gain back CPU time. Further // some more time might have passed before I obtained the lock! int64_t time = timeInMS() - start; // Correct the number of thread switches accordingly COUNTER = (uint32_t)(((uint64_t)COUNTER * 2 * 1000) / time); printf("Number of thread switches in about one second was %u\n", COUNTER); printf("roughly %f microseconds per switch\n", 1000000.0 / COUNTER); return 0; }

    Read the article

  • Why do most Database developers hate Agile

    - by Calm Storm
    To me "Agile" methodology is a common-sense oriented approach and one that should likely be adopted for most software projects. I find that while a lot of Middle Tier Developers and Front End developers find it a very sensible project delivery model, plenty of Database developers (and good ones) seem to be totally against it. They are very keen on knowing the biggest picture and designing a database solution that will cater to that. They do not seem to like "Vertical striping" of a functionality. They would rather see the complete design document/feature document instead of concentrating on small user stories. Sarcasm aside, can someone realistically provide some insight as to why this mentality is prevalent? Especially DB devs? What would be a convincing argument against that?

    Read the article

  • TerminateProcess and deadlocks

    - by Tony
    Is it real that the TerminateProcess function in Windows could hang because the threads inside the process were stuck in a deadlock? Example: Process A is running under Process B's control, now Process A gets into a deadlock and Process B detects this and decides to 'Kill' process A using TerminateProcess. Would it be successful in killing the hung Process A?

    Read the article

  • Handling a Long Running jsp request on the server using Ajax and threads

    - by John Blue
    I am trying to implement a solution for a long running process on the server where it is taking about 10 min to process a pdf generation request. The browser bored/timesout at the 5 mins. I was thinking to deal with this using a Ajax and threads. I am using regular javascript for ajax. But I am stuck with it. I have reached till the point where it sends the request to the servlet and the servlet starts the thread.Please see the below code public class HelloServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("POST request!!"); LongProcess longProcess = new LongProcess(); longProcess.setDaemon(true); longProcess.start(); request.getSession().setAttribute("longProcess", longProcess); request.getRequestDispatcher("index.jsp").forward(request, response); } } class LongProcess extends Thread { public void run() { System.out.println("Thread Started!!"); while (progress < 10) { try { sleep(2000); } catch (InterruptedException ignore) {} progress++; } } } Here is my AJax call <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>My Title</title> <script language="JavaScript" > function getXMLObject() //XML OBJECT { var xmlHttp = false; xmlHttp = new XMLHttpRequest(); //For Mozilla, Opera Browsers return xmlHttp; // Mandatory Statement returning the ajax object created } var xmlhttp = new getXMLObject(); //xmlhttp holds the ajax object function ajaxFunction() { xmlhttp.open("GET","HelloServlet" ,true); xmlhttp.onreadystatechange = handleServerResponse; xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(null); } function handleServerResponse() { if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.forms[0].myDiv.value = xmlhttp.responseText; setTimeout(ajaxFunction(), 2000); } else { alert("Error during AJAX call. Please try again"); } } } function openPDF() { document.forms[0].method = "POST"; document.forms[0].action = "HelloServlet"; document.forms[0].submit(); } function stopAjax(){ clearInterval(intervalID); } </script> </head> <body><form name="myForm"> <table><tr><td> <INPUT TYPE="BUTTON" NAME="Download" VALUE="Download Queue ( PDF )" onclick="openPDF();"> </td></tr> <tr><td> Current status: <div id="myDiv"></div>% </td></tr></table> </form></body></html> But I dont know how to proceed further like how will the thread communicate the browser that the process has complete and how should the ajax call me made and check the status of the request. Please let me know if I am missing some pieces. Any suggestion if helpful.

    Read the article

  • gprof and execl() - is it possible?

    - by Chris
    Background: I have a game (an old-school-esque MUD) which I've been attempting to profile with gprof. The documentation of gprof (on Linux 2.6) states that The profiled program must call "exit"(2) or return normally for the profiling information to be saved in the gmon.out file. Now, if I kill the server with the shutdown command, the application "returns normally" (i.e., main() returns) and I get a gmon.out to analyze. However, it's far more common to reboot the server. The reboot command does the following: Writes usernames and socket FD numbers to disc. Makes a call to execl(). The new process looks for the stored data, picks up the FDs, and moves on. I see the following error on the command line, as the whole process fails: Profiling timer expired ./program Question: Is it possible to get a gmon.out file from the execl()-calling process? Perhaps some environmental parameter to execl(), or else perhaps a different, gprof-friendly, system call to achieve the same effect (beginning a new process while preserving file descriptors)?

    Read the article

  • BackgroundWorker acting bizarrely...

    - by vdh_ant
    Hi guys I'm working on some code that calls a service. This service call could fail and if it does I want the system to try again until it works or too much time has passed. I am wondering where I am going wrong as the following code doesn't seem to be working correctly... It randomly only does one to four loops... protected virtual void ProcessAsync(object data, int count) { var worker = new BackgroundWorker(); worker.DoWork += (sender, e) => { throw new InvalidOperationException("oh shiznit!"); }; worker.RunWorkerCompleted += (sender, e) => { //If an error occurs we need to tell the data about it if (e.Error != null) { count++; System.Threading.Thread.Sleep(count * 5000); if (count <= 10) { if (count % 5 == 0) this.Logger.Fatal("LOAD ERROR - The system can't load any data", e.Error); else this.Logger.Error("LOAD ERROR - The system can't load any data", e.Error); this.ProcessAsync(data, count); } } }; worker.RunWorkerAsync(); } Cheers Anthony

    Read the article

  • Java: Executing a Java application in a separate process

    - by _ande_turner_
    Can a Java application be loaded in a separate process using its name, as opposed to its location, in a platform independent manner? I know you can execute a program via ... Process process = Runtime.getRuntime().exec( COMMAND ); ... the main issue of this method is that such calls are then platform specific. Ideally, I'd wrap a method into something as simple as... EXECUTE.application( CLASS_TO_BE_EXECUTED ); ... and pass in the fully qualified name of an application class as CLASS_TO_BE_EXECUTED.

    Read the article

  • C++ TerminateProcess function

    - by jemper
    I've been searching examples for the Win32 API C++ function TerminateProcess() but couldn't find any. I'm not that familiar with the Win32 API in general and so I wanted to ask if someone here who is better in it than me could show me an example for, Retrieving a process handle by its PID required to terminate it and then call TerminateProcess with it. If you aren't familiar with C++ a C# equivalent would help too.

    Read the article

  • Starting a second command while the first is still running from a batch file

    - by ids
    I am trying to create a batch file that will run a utility that opens a connection to a device on the internet then starts a telnet session. I am at the point where once the connection opens the batch file doesn't proceed. Batch file @echo off set /p serial=What are the last 8 of the STB's serial? udp.exe -c 127.0.0.1 23 %serial% x.x.x.x 11111 127.0.0.1 23 | telnet 127.0.0.1 Output What are the last 8 of the STB's serial? XXXXXXX Ready for XXXXXXX It just sits at the 'ready ...' line and never opens the telnet connection. I have tried various | and & but no luck.

    Read the article

  • List with items returns empty

    - by Power-Mosfet
    I have created a simple List function but if I Loop through the List it's empty. It should not be! All, thank you for the input. problem solved // List function public class process_hook { public static List<string> pro_hook = list_all_processes(); protected static List<string> list_all_processes() { var list = new List<string>(); foreach (Process i in Process.GetProcesses(".")) { try { foreach (ProcessModule pm in i.Modules) { list.Add(pm.FileName); } } catch { } } return list; } } // call private void button1_Click(object sender, EventArgs e) { foreach (String _list in process_hook.pro_hook) { Console.WriteLine(_list); } }

    Read the article

  • Nagios state transition and event handler issue

    - by Dattatray
    We are using Nagios to check duplicate processes. define service { use local-service host_name xxx service_description xxx Duplicate Processes check_interval 1 max_check_attempts 1 contact_groups admins event_handler restart-dependent-processes check_command check_procs_duplicate!2!3!2!2!2 } check_procs_duplicate checks if there are any duplicate processes and returns the state - e.g. CRITICAL. The event handler kills the duplicate processes and it's dependent processes and starts one instance of the process and dependent process. At the end of this again Nagios checks if there are any duplicate processes and sets the state accordingly - OK/WARNING/CRITICAL. The event handler takes more time to start the processes and during this time if someone manually starts the process, the state will remain in CRITICAL itself. During the next interval, Nagios will again check for duplicate processes and it will find it again CRITICAL. The event handler will not get executed now, as the previos and current both the states are CRITICAL. Any pointers about how to fix this issue?

    Read the article

  • Can mod_fcgid maintain a hard-minimum number of available appserver processes?

    - by user9795
    ...and if so, how? I'm using Apache2 + mod_fcgid to serve a perl Catalyst application, on a box that I own, and I'd like for mod_fcgid to maintain a minimum number of spun-up processes ready to go. The docs say that FcgidMinProcessesPerClass only enforces a minimum number of processes that will be retained in a process class after finishing requests How do I get apache to start up with a certain number of appserver subprocesses on an idle server without using artificial load to get there?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >