Ruby execution order in multithreaded program

In prep for hurricane irma I wrote a quick trash script to download a bunch of exercises off It works, but there's an error at the call to threads.each that I don't understand, all the code up until threads.each is synchronous if I under...
more »

2017-09-10 00:09 (1) Answers

Cancel Async operation

private async void TriggerWeekChanged(Week currentWeek) { await LoadDataForSelectedWeek(currentWeek); //Split into multiple methods } In case a user hammers on the Change_Week Button how can I cancel the current Task, and start a new one with ...
more »

2017-09-08 14:09 (2) Answers

C# Safely using LINQ across threads

I have a program that is constantly reading and parsing a large stream of data from a WebSocket. All of the parsing happens on one thread within the client, and the data is organized into a SortedSet<T> tree for fast operation. All of the data...
more »

2017-09-08 01:09 (1) Answers

Cooperative Scheduling vs Preemptive Scheduling?

In the book Core Java : Volume 1 Fundamentals -> chapter MultiThreading . The Author wrote as follows : "All modern desktop and server operating systems use preemptive scheduling. However, smaller devices such as cell phones may use coopera...
more »

2017-09-02 18:09 (3) Answers

Multithreading in tensorflow/keras

I would like to train some different models with parallel in one python application. The used models dont have necessary something in common, they are started in one application at different times. First I start one with no p...
more »

2017-09-01 12:09 (0) Answers

Why don't we need volatile with StampedLock?

Given a code sample from Oracle docs class Point { private double x, y; private final StampedLock sl = new StampedLock(); void move(double deltaX, double...
more »

2017-08-30 11:08 (2) Answers

RSS memory usage from concurrent.futures

I have a simple script that attempts to stress the concurrent.futures library as follows: #! /usr/bin/python import psutil import gc import os from concurrent.futures import ThreadPoolExecutor WORKERS=2**10 def run(): def x(y): ...
more »

2017-08-29 20:08 (2) Answers

Threads - Mac vs Linux

Great! I just finished my implementation on Mac with g++ / clang Configured with: --prefix=/Applications/ --with-gxx-include-dir=/Applications/
more »

2017-08-29 06:08 (1) Answers

Running two Timer simultaneously

I am developing an app that randomly select two CollectionView cells simultaneously. I have achieved that in android by adding different Runnables to Handler. In iOS selecting one cell is working perfectly fine with this code: let randomNumber1 = I...
more »

2017-08-28 16:08 (1) Answers

Print odd & even number using Multi threading

I am trying to learn Multi threading and for practice, I am trying to print odd & even number using two thread. I have created an object which will act as a lock for the both the threads. When I try to execute it throws java.lang.IllegalMonitorSt...
more »

2017-08-28 11:08 (3) Answers

Free TLS pointers for every thread

Reading the following page in MSDN: Using Thread Local Storage in a Dynamic-Link Library I can't understand who is responsible for freeing the memory pointed by the TLS slot of each thread in the case of a FreeLibrary() call. From what I understan...
more »

2017-08-16 10:08 (1) Answers

C socket blocking call

I wonder about the behaviour of socket on blocking and nonblocking actions. What happens to threads blocking on socket when the socket blocking mode changes ? Here is the scenario; thread1(T1) creates a UDP socket and fd = socket(AF_INET , SOCK_DGRA...
more »

2017-08-11 15:08 (4) Answers

Why does my Swing main thread die?

Morning, I'm facing a strange problem with Java - Swing. This is my main method public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { ...
more »

2017-08-10 16:08 (1) Answers

How does URLSessionTask run

Say I have created an instance of URLSessionTask: let task = URLSession.shared.dataTask(with: url) { (data, response, error) in print (\(Thread.current)) } // I start the task by task.resume() I want to understand whether the URLSessionTask in...
more »

2017-08-02 16:08 (1) Answers