Search Results

Search found 8588 results on 344 pages for 'thread abort'.

Page 47/344 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • Using thread inter-communication to increase my server app's IO throughput; not sure how

    - by Howard Guo
    My server application creates a new thread for each incoming connection. Incoming requests are serialized in a BlockingQueue. There is one worker thread taking items from the queue, produce a response and send the response through socket. I have noticed a throughput issue: Currently, worker thread is responsible of sending the response message through socket, thus severely wasting processing power and throughput. I am considering: rather than sending the response itself, why not telling network IO threads to send the response? However, when I think about thread inter-communication, I cannot yet figure out how to approach it: Worker thread will produce a response, but how will it inform the response message to IO thread? Is there a standard/best practice? Thank you.

    Read the article

  • Android Service Multiple Thread Design

    - by Gernot
    Hello, A new question about android and services. Currently I'm developing a App that should send images to a server. It should also be possible to send more images parallel. I made a service that creates for every image a new image. The activity can bind to that service and gather information about the progress. I want to show the current status for every image in a notification (and when the user clicks a notification, an activity with the progress for that image should be shown). But I get several problems with that approach. There are errors with binding, the notification pending event starts the activity completly new, so I lose information about currently sending images and so on. Can someone plase tell me, how I could design such a problem in a appropriate way. thx

    Read the article

  • multi-thread in MS Access, async processing

    - by LanguaFlash
    I know that title sounds crazy but here is my situation. After a certain user event I need to update a couple tables that are "unrelated" to what the user is currently doing. Currently this takes a couple seconds to execute and causes the user a certain amount of frustration. Is there a way to perform my update in a second process or in a manner that doesn't "freeze" the UI of my app while it is processing? Thanks

    Read the article

  • How do I read user input in python thread?

    - by Sid H
    I'm trying to read from a thread in python as follows import threading, time, random var = True class MyThread(threading.Thread): def set_name(self, name): self.name = name def run(self): global var while var == True: print "In mythread " + self.name time.sleep(random.randint(2,5)) class MyReader(threading.Thread): def run(self): global var while var == True: input = raw_input("Quit?") if input == "q": var = False t1 = MyThread() t1.set_name("One") t2 = MyReader() t1.start() t2.start() However, if I enter 'q', I see the following error. In mythread One Quit?q Exception in thread Thread-2: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 522, in __bootstrap_inner self.run() File "test.py", line 20, in run input = raw_input("Quit?") EOFError In mythread One In mythread One How does on get user input from a thread?

    Read the article

  • Java Application/Thread Server

    - by Manrico Corazzi
    I am looking for something very close to an application server with these features: it should handle a series of threads/daemons, allowing the user to start-stop-reload each one without affecting the others it should keep libraries separated between different threads/daemons it should allow to share some libraries Currently we have some legacy code reinventing the wheel... and not a perflectly round-shaped one at that! I thought to use Tomcat, but I don't need a web server, except maybe for the simple backoffice user interface (/manager/html). Any suggestion? Is there a non-web application server, or is there a better alternative to Tomcat (more lightweight, for example, or easier to configure)? Thanks in advance.

    Read the article

  • How to use double buffering inside a thread and applet

    - by russell
    I have a question about when paint and update method is called?? i have game applet where i want to use double buffering.But i cant use it.the problem is In my game there is a ball which is moving inside run() method.I want to know how to use double buffering to swap the offscreen image and current image.Someone plz help. And when there is both update() and paint() method.which are called first,when and why ???

    Read the article

  • Should I thread this?

    - by Psytronic
    I've got a "Loading Progress" WPF form which I instantiate when I start loading some results into my Main Window, and every time a result is loaded I want the progress bar to fill up by x amount (Based on the amount of results I'm loading). However what happens is that the Progress bar in the window stays blank the entire time, until the results have finished loading, then it will just display the full progress bar. Does this need threading to work properly? Or is it just to do with the way I'm trying to get it to work? //code snippet LoadingProgress lp = new LoadingProgress(feedCount); lp.Show(); foreach (FeedConfigGroup feed in _Feeds) { feed.insertFeeds(lp); } //part of insertFeeds(LoadingProgress lbBox) foreach (Feeds fd in _FeedSource) { lpBox.setText(fd.getName); XmlDocument feedResults = new XmlDocument(); feedResults.PreserveWhitespace = false; try { feedResults.Load(wc.OpenRead(fd.getURL)); } catch (WebException) { lpBox.addError(fd.getName); } foreach (XmlNode item in feedResults.SelectNodes("/rss/channel/item")) { //code for processing the nodes... } lpBox.progressIncrease(); } If more code is needed let me know.

    Read the article

  • WCF MSMQ consumer thread count

    - by Andy White
    What's the best way to configure the maximum number of threads that can pull messages from an MSMQ queue, using a netMsmqBinding in WCF? For example, say I have an MSMQ service for which I only want to have 2 (or 10, or whatever number of) worker threads pulling messages off at a time.

    Read the article

  • ReaderWriterLockSlim question.

    - by Kamarey
    There are lots written about the ReaderWriterLockSlim class which allows multiple read and a single write. All of these (at least that I had found) tell how to use it without much explanation why and how it works. The standard code sample is: lock.EnterUpgradeableReadLock(); try { if (test if write is required) { lock.EnterWriteLock(); try { change the resourse here. } finally { lock.ExitWriteLock(); } } } finally { lock.ExitUpgradeableReadLock(); } The question is: if upgradeable lock permits only a single thread to enter its section, why I should call EnterWriteLock method within? What will happen if I don't? Or what will happen if instead of EnterUpgradeableReadLock I will call EnterWriteLock and will write to a resource without using upgradeable lock at all?

    Read the article

  • Progress dialog getting dismissed before the thread gets finished - Android

    - by user264953
    Hi experts, I use the code provided by Fedor in the following link, in order to get the latitude and longitude from my simple demo app. I am trying to fetch the latitude and longitude using the MyLocation class provided by him in that link. What is the simplest and most robust way to get the user's current location in Android? I try to fetch the latitude and longitude on a button click. On the button click, I start an async task and delegate the location fetching work to the do in background method of my asynctask. pre execute - progressdialog initiated. post execute - progress dialog dismissed. This is how, the progress dialog in my code should work and here is the issue which I have. THe progress dialog gets initiated correctly, but even before the latitude and longitude gets printed in the doinbackground method, the progress dialog gets dismissed. I do not understand why this happens. Here is my front end activity public class LocationServices extends Activity { MyLocation myLocation = new MyLocation(); LocationResult locationResult; TextView tv1, tv2; Location location; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tv1 = (TextView) findViewById(R.id.tv1); tv2 = (TextView) findViewById(R.id.tv2); Button btn = (Button) findViewById(R.id.Button01); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { new LocationAsyncTasking().execute(); } }); } public class LocationAsyncTasking extends AsyncTask<String, Void, Void> { ProgressDialog dialog; int totalAvail; protected void onPreExecute() { // this.dialog.setMessage("Inserting data..."); dialog = new ProgressDialog(LocationServices.this); this.dialog.setMessage("Fetching data..."); this.dialog.show(); } protected Void doInBackground(String... args) { Looper.prepare(); locationResult = new LocationResult() { public void gotLocation(Location location) { // TODO Auto-generated method stub // LocationServices.this.location = location; System.out.println("Progress dialog should be present now - latitude"+location.getLatitude()); System.out.println("Progress dialog should be present now - longitude"+location.getLongitude()); } }; myLocation.getLocation(LocationServices.this, locationResult); return (null); } protected void onProgressUpdate(Integer... progress) { } protected void onPostExecute(Void unused) { dialog.dismiss(); } } } I am quite puzzled, thinking of what makes this progress dialog disappear even before the SOP in doinbackground is finished. Experts, please help me understand and resolve this issue. Any help in this regard is well appreciated. Looking forward, Best Regards, Rony

    Read the article

  • Smart Background Thread Task in Ruby on Rails?

    - by elado
    I need to perform a task every 5 seconds, but only when users are using the application. As for now, I use cron that works every minute and activates a task that repeats itself every 5 seconds with sleeps between, for a minute. However, it works also when the application isn't being used. Is there a gem that will do this kind of thing?

    Read the article

  • thread management in nbody code of cuda-sdk

    - by xnov
    When I read the nbody code in Cuda-SDK, I went through some lines in the code and I found that it is a little bit different than their paper in GPUGems3 "Fast N-Body Simulation with CUDA". My questions are: First, why the blockIdx.x is still involved in loading memory from global to share memory as written in the following code? for (int tile = blockIdx.y; tile < numTiles + blockIdx.y; tile++) { sharedPos[threadIdx.x+blockDim.x*threadIdx.y] = multithreadBodies ? positions[WRAP(blockIdx.x + q * tile + threadIdx.y, gridDim.x) * p + threadIdx.x] : //this line positions[WRAP(blockIdx.x + tile, gridDim.x) * p + threadIdx.x]; //this line __syncthreads(); // This is the "tile_calculation" function from the GPUG3 article. acc = gravitation(bodyPos, acc); __syncthreads(); } isn't it supposed to be like this according to paper? I wonder why sharedPos[threadIdx.x+blockDim.x*threadIdx.y] = multithreadBodies ? positions[WRAP(q * tile + threadIdx.y, gridDim.x) * p + threadIdx.x] : positions[WRAP(tile, gridDim.x) * p + threadIdx.x]; Second, in the multiple threads per body why the threadIdx.x is still involved? Isn't it supposed to be a fix value or not involving at all because the sum only due to threadIdx.y if (multithreadBodies) { SX_SUM(threadIdx.x, threadIdx.y).x = acc.x; //this line SX_SUM(threadIdx.x, threadIdx.y).y = acc.y; //this line SX_SUM(threadIdx.x, threadIdx.y).z = acc.z; //this line __syncthreads(); // Save the result in global memory for the integration step if (threadIdx.y == 0) { for (int i = 1; i < blockDim.y; i++) { acc.x += SX_SUM(threadIdx.x,i).x; //this line acc.y += SX_SUM(threadIdx.x,i).y; //this line acc.z += SX_SUM(threadIdx.x,i).z; //this line } } } Can anyone explain this to me? Is it some kind of optimization for faster code?

    Read the article

  • Android lifecycle of thread-based game

    - by ehehhh
    I ran into a bit of trouble while trying to get my game to work correctly after being put to the background by the user or a phone call for example. My app has a SurfaceView class called GameView, which has the onDraw() method to do all the necessary drawing for my game and two threads - one for calling the onDraw() and one for doing the necessary calculations for the game's logic. I succesfully implemented onPause() and onResume(). (I paused both threads when back button was pressed and resumed them after user cancelled in the AlertDialog.) Now I would like to have the game paused the same way when onStop() gets called. I put both threads on pause and saved my characters location in the savedInstanceState, but when I start my app again, no method gets called (I checked with Logcat). I believe onRestart() should be called first, then onStart() and then onResume(), but none of that happens. What am I doing wrong? (Didn't include any code, because it seems to be a problem of me not understanding the lifecycle, not a problem in code. If it seems necessary, I'll post the parts you request.)

    Read the article

  • ThreadPoolExecutor fixed thread pool with custom behaviour

    - by Simone Margaritelli
    i'm new to this topic ... i'm using a ThreadPoolExecutor created with Executors.newFixedThreadPool( 10 ) and after the pool is full i'm starting to get a RejectedExecutionException . Is there a way to "force" the executor to put the new task in a "wait" status instead of rejecting it and starting it when the pool is freed ? Thanks Issue regarding this https://github.com/evilsocket/dsploit/issues/159 Line of code involved https://github.com/evilsocket/dsploit/blob/master/src/it/evilsocket/dsploit/net/NetworkDiscovery.java#L150

    Read the article

  • Lock thread using somthing other than a object

    - by Scott Chamberlain
    when using a lock does the thing you are locking on have to be a object. For example is this legal static DateTime NextCleanup = DateTime.Now; const TimeSpan CleanupInterval = new TimeSpan(1, 0, 0); private static void DoCleanup() { lock ((object)NextCleanup) { if (NextCleanup < DateTime.Now) { NextCleanup = DateTime.Now.Add(CleanupInterval); System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(cleanupThread)); } } return; } EDIT-- From reading SLaks' responce I know the above code would be not valid but would this be? static MyClass myClass = new MyClass(); private static void DoCleanup() { lock (myClass) { // } return; }

    Read the article

  • Trying to write priority queue in Java but getting "Exception in thread "main" java.lang.ClassCastEx

    - by Dan
    For my data structure class, I am trying to write a program that simulates a car wash and I want to give fancy cars a higher priority than regular ones using a priority queue. The problem I am having has something to do with Java not being able to type cast "Object" as an "ArrayQueue" (a simple FIFO implementation). What am I doing wrong and how can I fix it? public class PriorityQueue<E> { private ArrayQueue<E>[] queues; private int highest=0; private int manyItems=0; public PriorityQueue(int h) { highest=h; queues = (ArrayQueue[]) new Object[highest+1]; <----problem is here } public void add(E item, int priority) { queues[priority].add(item); manyItems++; } public boolean isEmpty( ) { return (manyItems == 0); } public E remove() { E answer=null; int counter=0; do { if(!queues[highest-counter].isEmpty()) { answer = queues[highest-counter].remove(); counter=highest+1; } else counter++; }while(highest-counter>=0); return answer; } }

    Read the article

  • How to tell the parent that the thread is done in C++ using pthreads ?

    - by milleroff
    Hi. I have a TCP Server application that serves each client in a new thread using POSIX Threads and C++. The server calls "listen" on its socket and when a client connects, it makes a new object of class Client. The new object runs in its own thread and processes the client's requests. When a client disconnects, i want some way to tell my main() thread that this thread is done, and main() can delete this object and log something like "Client disconnected". My question is, how do i tell to the main thread, that a thread is done ?

    Read the article

  • How do I know if a boost thread is done ?

    - by jules
    I am using boost::thread to process messages in a queue. When a first message comes I start a message processing thread. When a second message comes I check if the message processing thread is done. if it is done I start a new one if it is not done I don nothing. How do I know if the thread is done ? I tried with joinable() but it is not working, as when the thread is done, it is still joinable. I also tried to interrupt the process at once, and add an interruption point at the end of my thread, but it did not work. Thanks

    Read the article

  • OpenThread() through diiferent thread numbers ?

    - by user354641
    Hi there . I'm confusing about opening different threads with OpenThread Function and examining them with NtQueryInformationThread native function . I have no problem with NtQueryInformationThread & I can examine them finely. the problem is I don't know how to loop through different number of threads using OpenThread (with SetDebugPrivilege Consideration) . suppose we have different threads from number 5100 to 5200 & we want to examine them sequentially : for example 5100, 5101, 5102, 5103, 5104, 5105 ... 5200 ... . I don't know how to use OpenThread Function in delphi in right way ... . I'm using this syntax & I found it wrong : OpenThread(THREAD_ALL_ACCESS,false,(DWORD)5100) . if anyone could guide me how to use OpenThread though different number of threads it would be great . thanks alot .

    Read the article

  • Cross Thread problem C#

    - by Frederik Witte
    Hello people - I got this code (lg_log is a listbox, and i want it to log the start_server.bat) Here is the code i got: public void bt_play_Click(object sender, EventArgs e) { lg_log.Items.Add("Starting Mineme server .."); string directory = Directory.GetCurrentDirectory(); var info = new ProcessStartInfo(directory + @"\start_base.bat") {UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = directory + @"\Servers\Base"}; var proc = new Process { StartInfo = info, EnableRaisingEvents = true }; proc.OutputDataReceived += (obj, args) => { if (args.Data != null) { lg_log.Items.Add(args.Data); } }; proc.Start(); proc.BeginOutputReadLine(); lg_log.Items.Add("Server is now running!"); proc.WaitForExit(); } When i run this, i'll get an error .. Anybody can help me? I'll rate the answer up! :D Edit: The error i get is this: System.InvalidOperationException Hope it helps :) The error comes at the lg_log.Items.Add(args.Data); code line

    Read the article

  • XNA Multi-Thread Jitters

    - by Ice Phoenix
    Hi guys, brand new question. Just implemented multi-threading into my XNA game as it was unable to keep up with using 1 processor. MT is all implemented fine and everything, however the player seems to jitter all over the spot every now and then. I originally thought it was a loss of data between the update and render, but even when i did the player update in the render it did the same thing. It's not a memory/processor issue as i'm no where near maxing out my RAM or processors. It's strange aswell because none of the other entities in the game seem to have any of these issues. Any ideas at all??

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >