Questions tagged [single-threaded]

Single threaded as opposed to multithreading defines a code section, object or application that can run only using and allowing a single thread.

Single threaded as opposed to multithreading defines a code section, object or application that can run only using and allowing a single thread.

References

209 questions
3
votes
1 answer

Single Threaded Program vs Multithreaded Program (measuing time elapsed)

I want to know if I need to measure time elapsed then Single Threaded Program is good approach or Multithreading Program is a good approach for that. Below is my single threaded program that is measuring the time of our service- private static void…
AKIWEB
  • 19,008
  • 67
  • 180
  • 294
3
votes
1 answer

Tornado non-blocking while run in single thread?

Tornado is non-blocking webserver. However, all of the operations are run in a single thread. How does it stay non-blocking if it is handled by single thread? If there is a long operation, will it block new coming request? Is downloading a large…
3
votes
1 answer

How do I check whether the other end has closed my socket stream, from a single thread?

The usocket FAQ suggests that the way I should do this is by reading from a socket-stream and checking for an end-of-file result. That works in the case where I've got one thread active per socket, but it doesn't seem to satisfy for the case where…
Inaimathi
  • 13,853
  • 9
  • 49
  • 93
3
votes
1 answer

ActiveX control cannot be instantiated because thread is in a single-threaded apartment. Happens after waking PC from sleep

I am working on a VOIP client (Window's form) that opens a browser window (ExtendedWebBrowser) when a call is made or received. Normally it works fine but if the computer is put into sleep mode and then woken the program will crash with the…
3
votes
3 answers

ExtJs: What will be the sequence of code execution in ajax call?

Given the fact that Javascript is a single-threaded language, what would be the sequence of execution in the following code in ExtJs? FuncA(); Ext.Ajax.request({ url: 'ajax.php', params: { id: 1 }, success:…
netemp
  • 4,115
  • 12
  • 43
  • 63
2
votes
1 answer

Number of threads created is 12 but still runs only on one core of 12 core-CPU

I have a strange issue. I have a Matlab mexfunction in which I have used OpenMP directives/functions. Before the beginning of a parallel section (parallel for...), I use commands to set and print the number of threads created: nP =…
2
votes
1 answer

Single-Threaded Windows Service Delaying OnStop

I have a Windows Service (C# 4.0) that picks messages off of a private message queue and for each message sends one or more emails (typically 4 or 5 at most) based on message content. Message volume is low so I have avoided complexity and left the…
Serexx
  • 1,232
  • 1
  • 15
  • 32
2
votes
0 answers

What is the effect of heavy computation on `Timer.periodc` ( or `setInterval`)

I was wondering what is the effect of heavy computation on Timer.periodc which often happens when making bots doing at an heavy task and at the same time running a job at a regular interval. So I made this code but the results confused me. import…
TSR
  • 17,242
  • 27
  • 93
  • 197
2
votes
2 answers

WCF - possible to switch between single-thread and multi-thread purely through config?

I have developed a WCF service (which happens to listen on an MSMQ queue). I haven't put any specific threading-related code in, so it runs by default in a multi-threaded manner. This will be fine (and most probably desirable) for a live…
PeteH
  • 2,394
  • 1
  • 20
  • 29
2
votes
2 answers

Flutter update progress in compute method

I have to save many images to the device to make videos. As saving multiple images takes so much time and resources, I use compute to save images. I want to show the progress in saving images so that users can notice how much time left for…
seung min
  • 125
  • 1
  • 12
2
votes
1 answer

Run all tests in same thread NUnit

I have some tests that do some write-operation on a database. I know that´s not really unit-testing, but let´s leave that asside. In order to enable every test to work on a clean workspace, I rollback all transactions doe so far. However I randomly…
MakePeaceGreatAgain
  • 35,491
  • 6
  • 60
  • 111
2
votes
2 answers

What the execution order of asynchronous functions if there are multiple in one thread?

I am learning the concept of asynchronous functions in JavaScript. I know JavaScript is single threaded and call back functions are put behind the synchronous executable code in the thread. This article explained pretty…
Gaoyan
  • 43
  • 5
2
votes
1 answer

Javascript - equal time timesetouts - random order of execution even though javascript is single threaded?

I got confused when I read that when I set the (same) time in 2 timeSetout methods, the order in which the function will be called cannot always be predicted (there was not reasoning provided). setTimeout(()=> console.log("first"),…
javascripting
  • 1,135
  • 4
  • 25
  • 46
2
votes
2 answers

C++ uWebSockets integrate event loop in one thread

I'm using uWebSockets in my C++ project, where I have my own custom event loop. It's a while loop, with a variable delay between each execution. It looks something like this: while (true) { std::this_thread::sleep_for (variableTime); //…
Luke
  • 2,038
  • 3
  • 22
  • 46
2
votes
0 answers

Is 'non-threaded' a synonym of 'single threaded'?

Apache web server documentation says prefork mpm implements a non-threaded, pre-forking web server. And I'm a little bit confused about the term 'non-threaded'. Is 'non-threaded' a synonym of 'single threaded'?…
emsloth
  • 53
  • 1
  • 5