Questions tagged [executioncontext]

Refers to concept of an environment where code is evaluated and executed. This refers to global and function execution contexts, how control is switched between, how binding occurs in context etc.

Execution context is abstract concept of programming and is closely related to executing code itself and order how it will executed (execution stack), how pointers to objects are created and used and how they're divided from each other. Because of abstract nature of concept itself Execution context is closely tied to particular implementation in programming languages (Javascript for example). Check related tags

Resources

Related tags

196 questions
2
votes
1 answer

Counting the number of threads in an ExecutionContext

Suppose I want to know how many threads there are in a given ExecutionContext. So I am writing a function like this def count(implicit ec: ExecutionContext): Int = { val promise = Promise[Unit] val counter = new AtomicInteger(0) for (_ <- 0 to…
Michael
  • 41,026
  • 70
  • 193
  • 341
2
votes
0 answers

Javascript execution context & variables in V8

I know the V8 is consist of Memory Heap and Call Stack The execution context is located in the call stack. Global variables exist in the global execution context, and local variables exist in each execution context. The reference type identifier is…
marulloc
  • 21
  • 1
2
votes
1 answer

How to switch CurrentCulture of MainThread from async context?

I have an old API with switches the current culture in that way: private void ChangeCulture(int lcid) { Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ChangeCulture Culture Start: {Thread.CurrentThread.CurrentCulture}"); …
Klappstuhl
  • 33
  • 5
2
votes
3 answers

Redeclaration with var works but not with let in Chrome Snippets

I started to learn JavaScript and I use Snippets or just Console in Google Chrome. I don't understand one thing. When I run snippet like: let x = 5; console.log(x); multiple times. Everything is ok, but when I first run this: var x =…
swch
  • 1,432
  • 4
  • 21
  • 37
2
votes
1 answer

JavaScript : Please Explain this weird behaviour

Just Started learning about JS. CASE-1 Please look at the below given image. My Understanding for this behavior : JS interpreter on reaching line 9 which commands to execute function a(); will create a new execution context for function a (or we…
Jay Patel
  • 505
  • 6
  • 10
2
votes
1 answer

'this' behaves differently in node environment than browser

I am following along with a tutorial about this and execution context. I observed that this code executes properly in the Chrome Console: var globalThis = this function myFunc () { console.log('globalThis: ', globalThis) console.log('this…
Tycholiz
  • 1,102
  • 4
  • 17
  • 33
2
votes
1 answer

Is Scala ExecutionContext as Class or Method parameter more idiomatic?

Is it more idiomatic Scala to pass in ExecutionContext per method like class Foo { def bar(a: Int, b: Int)(implicit ec: ExecutionContext): Future[Int] = { Future(a + b) } def baz(a: Int, b: Int)(implicit ec: ExecutionContext):…
krismath
  • 1,879
  • 2
  • 23
  • 41
2
votes
1 answer

How is the ExecutionContext class related to "contexts"?

Contexts create subdivided "containers" within domains for objects with special needs (or in the case of objects that don't have special needs, the default context is used). I am having trouble understanding how the ExecutionContext class relates to…
richard
  • 12,263
  • 23
  • 95
  • 151
2
votes
1 answer

How can I write a save GUI-Aktor for Scalafx?

Basically I want an Aktor to change a scalafx-GUI safely. I've read many posts describing this, but there where sometimes contradictory and some years old, so some of them might be outdated. I have a working example code and I basically want to know…
Michael W.
  • 182
  • 1
  • 12
2
votes
1 answer

How to configure Akka Http for low latency

I'm tweaking my Akka Http server now and having very horrible results when loading it with concurrent requests. Since I wasn't sure if perhaps I had a hidden blocking IO request somewhere I figured it would be worth testing the example project from…
Avba
  • 14,822
  • 20
  • 92
  • 192
2
votes
2 answers

this of a javascript function when called from within another object

From what I have read and understood, execution context(this) of a function has nothing to do with where its declared, but from where it was invoked (call site). Consider 2 cases, where foo is defined in global context- //1. function foo(){…
mustafa1993
  • 541
  • 1
  • 5
  • 17
2
votes
1 answer

JS: "this" in function context in strict mode, MDN spec doesn't match chrome 67 implementation

From MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this, it says: In strict mode, however, the value of this remains at whatever it was set to when entering the execution context, so, in the following case, this…
chongman
  • 2,447
  • 4
  • 21
  • 23
2
votes
2 answers

Execution context's in JavaScript

I am trying to grasp execution contexts and have a question around for loops. Consider the following... function copyArrayAndMutate(array, instructions) { let output = [] for(let i = 0; i < array.length; i++) { …
Harry Blue
  • 4,202
  • 10
  • 39
  • 78
2
votes
2 answers

Javascript execution context order

First of all, I call func1 and so it gets on top of the global execution context. And then it calls func2. What I wanna know is, after calling func2, does func1 immediately return or get off the execution stack? Or is it like, first func2 gets on…
2
votes
1 answer

Scala future execution

I have two futures. I want to execute them in order. For example: val ec: ExecutionContextExecutor = ExecutionContext.Implicits.global val first=Future.successful(...) val second=Future.successful(...) When first is completed then second should be…
gg gg
  • 129
  • 7