I want to send a file in chunks by calling a function that calls a webservice using multithreading.
The following is a brief of the code:
int chunkSize = "whatever in byte";
byte[] fileBytes = ConvFileToByte("the pathe of the file");
int numberOfParts = (int)Math.Ceiling((decimal)fileSize / chunkSize);
for (int i; i< numberOfParts; i++...
Again I want to talk about safety of the Thread.Abort function. I was interested to have some way to abort operations which I can't control really and don't want actually, but I want to have my threads free as soon as possible to prevent thread thirsty of my application.
So I wrote some test code to see if it's possible to use Thread.A...
How to wait and notify like in Java In C/C++ for shared memory between two or more thread?I use pthread library.
...
The javadoc for
Executors.newSingleThreadScheduledExecutor
says
"... the returned executor is guaranteed not to be reconfigurable to use additional threads".
What does the above sentence mean? Does it mean the returned instance may not have nested threads?
...
I have some read-only data that I want to initialise and then re-initialise periodically in a thread-safe manner. For initialisation I've pulled in Joe Duffy's LazyInit and LazyInitOnceOnly structs as detailed in his blog, which use the Double-Checked locking pattern. So my current implementation of the getter simply wraps around his L...
I create a Windows timer using the following
FHandle := SetTimer(0, 0, 1000, TFNTimerProc(@TMyClass.MyMethod));
Is this thread shown in the Delphi "Threads" window. If Yes how I can get this Thread ID?
...
I'm developing a project and I have to make a wrapper to some hardware functions.
We have to write and read data to and from a non-volatile memory. I have a library with the read and write functions from the seller company. The problem is that these functions should be called with a delay between each call due to hardware characteristic...
What is the best practice for setting up a background process that runs every 10 minutes in a WinForm project? Is it to use a backgroundworker off of the form? Or is there a more generic way that would apply to many more project styles?
Maybe some code I should call right before the line:
Application.Run(new Form1());
...
I have been given the task to fix an Embedded Operating System which is written in C/C++. The Current thread scheduler being used is very similar to Round Robin Scheduling, except it lacks one very important feature, the ability to interrupt threads and then return executing thus creating a dependable "slice" of execution time.
My Qu...
I'm sending a log message to the main form using this:
For send the message:
procedure LogMsg(Msg: string; Kind:TMsgType=msgNormal);
var
p: pChar;
begin
case Kind of
msgError: Msg := '[Error] ' + Msg;
msgInformation: Msg := '# ' + Msg;
msgExternal: Msg := 'Plugin: ' + Msg;
end;//if
GetMem(p, (Length(Msg) + 1)*S...
I have a module that manages timers in my aplication. This class has basibly three functions:
Instance of ACE_Reactor is used internally by the module to manage the timers.
schedule timer - calls ACE_Reactor::schedule_timer().
One of the arguments is a callback, called upon timer experation.
cancel timer - calls ACE_Reactor::cancel_t...
How could I start a thread in a different session? I need to start a thread in the interactive session (session 1) from a service in the non-interactive session (session 0). I have done this with a process before by using SetTokenInFormation and DuplicateTokenEx and then passing this to CreateProcessAsUser. I was hoping I could do the sa...
I have a large XML data file (>160M) to process, and it seems like SAX/expat/pulldom parsing is the way to go. I'd like to have a thread that sifts through the nodes and pushes nodes to be processed onto a queue, and then other worker threads pull the next available node off the queue and process it.
I have the following (it should have...
Here is my problem: I have to be able to send and receive to a device over serial. This has to be done in a multi-threaded fashion. The flow is as follows:
Wait for device to send me something - or if idle, then query status to see if online with device
If device sends me something, then process message, acknowledge, and tell device to...
It makes me confused when I read the article by Zarko Gajic today:
"Multithreaded Delphi Database Queries"
Article URL: http://delphi.about.com/od/kbthread/a/query_threading.htm
Sourecode: http://delphi.about.com/library/weekly/code/adothreading.zip
With the code of "TCalcThread.Execute" procedure, Why the following code do not need ...
Hi,
I wonder if someone can help me - I've been programming VB.Net for a long time but have rarely had to do much threading in ASP.Net.
I'm attempting to take "screenshots" of websites using an in-memory browser. These images are then logged in a DB and written to the local file system.
When I run it on my local server, it all works f...
Possible Duplicate:
Creating a blocking Queue<T> in .NET?
I have typical producer and consumer threading issue. However the only difference is that the producer is allowed to build up a buffer of 5 items after which it has to wait until some items are consumed.
What would be the best solutions to implement this in c#.
Currently...
Hey,
I have a list of objects,
for each object i want to run a totally separate thread (thread safty),like....i will pick one a object from my list in while loop and run a thread and then for next object run the next threads...all thread should be synchronized such that resources (values/connection (close/open) )shared by them s...
I've got an ObservableCollection<A> a_collection; The collection contains 'n' items. Each item A looks like this :
public class A : INotifyPropertyChanged
{
public ObservableCollection<B> b_subcollection;
Thread m_worker;
}
Basically, it's all wired up to a WPF listview + a details view control which shows the b_subcollection...
I have a BitmapSource that was created and frozen by a background thread.
On the UI thread I want to rotate the image and freeze it again (so the background thread can create thumbnails).
// transforming the image works
var img=new TransformedBitmap(Image, new RotateTransform(90));
// but Freeze is not allowed - will throw "The calling...