multithreading

Make a JavaFX application wait between an animation

自闭症网瘾萝莉.ら 提交于 2020-06-09 05:24:06
问题 I am working on a simple game using JavaFX. What I want here is that at the end of the loop, the application waits for a specified period of time, and then runs again. When I run this code on the application thread, the view doesn't get updated and the Nodes disappear without me seeing the animation. If I create a new thread, then nothing happens at all. Since this animation isn't run until the game has been completed, it doesn't matter if nothing else works until the animation is completed.

`ProcessPoolExecutor` works on Ubuntu, but fails with `BrokenProcessPool` when running Jupyter 5.0.0 notebook with Python 3.5.3 on Windows 10

≡放荡痞女 提交于 2020-06-08 04:16:10
问题 I'm running Jupyter 5.0.0 notebook with Python 3.5.3 on Windows 10. The following example code fails to run: from concurrent.futures import as_completed, ProcessPoolExecutor import time import numpy as np def do_work(idx1, idx2): time.sleep(0.2) return np.mean([idx1, idx2]) with ProcessPoolExecutor(max_workers=4) as executor: futures = set() for idx in range(32): future = winprocess.submit( executor, do_work, idx, idx * 2 ) futures.add(future) for future in as_completed(futures): print(future

`ProcessPoolExecutor` works on Ubuntu, but fails with `BrokenProcessPool` when running Jupyter 5.0.0 notebook with Python 3.5.3 on Windows 10

Deadly 提交于 2020-06-08 04:13:09
问题 I'm running Jupyter 5.0.0 notebook with Python 3.5.3 on Windows 10. The following example code fails to run: from concurrent.futures import as_completed, ProcessPoolExecutor import time import numpy as np def do_work(idx1, idx2): time.sleep(0.2) return np.mean([idx1, idx2]) with ProcessPoolExecutor(max_workers=4) as executor: futures = set() for idx in range(32): future = winprocess.submit( executor, do_work, idx, idx * 2 ) futures.add(future) for future in as_completed(futures): print(future

`ProcessPoolExecutor` works on Ubuntu, but fails with `BrokenProcessPool` when running Jupyter 5.0.0 notebook with Python 3.5.3 on Windows 10

流过昼夜 提交于 2020-06-08 04:13:04
问题 I'm running Jupyter 5.0.0 notebook with Python 3.5.3 on Windows 10. The following example code fails to run: from concurrent.futures import as_completed, ProcessPoolExecutor import time import numpy as np def do_work(idx1, idx2): time.sleep(0.2) return np.mean([idx1, idx2]) with ProcessPoolExecutor(max_workers=4) as executor: futures = set() for idx in range(32): future = winprocess.submit( executor, do_work, idx, idx * 2 ) futures.add(future) for future in as_completed(futures): print(future

Java Multipleclients - server javafx

别等时光非礼了梦想. 提交于 2020-06-01 07:40:31
问题 I have to create an electronic mail with JavaFX using socket, FXML. I need to create one server and 3 clients that are my three accounts and they must start in parallel. Every client must have an associated thread but my problem is: when I start the first client it works, so the FXML file opens. But when I try to open the second client Intellij shows a pop-up that says to me: Stop And Rerun. In my FXML I have a connect button in which I must choose one of my accounts and then my server says

passing array as return from function in multi threaded app

烈酒焚心 提交于 2020-06-01 05:49:26
问题 i try to make code which is multithreaded and at certain step i have to retrieve array made on heap. this is the code: the following function will call another function called read_bi5_to_bin and it will pass to it unsigned char* initialized as nullptr data_bin_buffer int HTTPRequest::read_bi5_main(boost::filesystem::path p, ptime epoch) { boost::unique_lock<boost::mutex> read_bi5_to_bin_lock(m_read_bi5_to_binMutex,boost::defer_lock); unsigned char *buffer; size_t buffer_size; int counter;

Generate random throughput from x number of threads and print performance numbers at the end?

纵饮孤独 提交于 2020-06-01 05:08:23
问题 I am working with cassandra databse and I am trying to get data from cassandra as shown below in my code. In the CassandraUtils constructor I initialize to cassandra cluster once and then I call GetAsync method to get data from cassandra. public class CassandraUtils { public CassandraUtils(string endpoints) { // connect to cassandra cluster here } /** * * Below method gets data from cassandra by making multiple async calls for each clientId. * */ public async Task<IList<Item>> GetAsync(IList

python threading confusing code 'int' object is not callable

泄露秘密 提交于 2020-06-01 04:58:31
问题 its messy i know, but the threading is so confusing ...i dont know if the problem is in my sintax or if it is in the method im using... the def do inserts in mysql (and its working when is not threading),another strange thing is that after runing the code i noticed rows are inserted correctly but i still get "self._target(*self._args, **self._kwargs) TypeError: 'int' object is not callable" def thistaginsert(tagy): global idn global forbidentags global termcount tagy = tagy[0] if not tagy

Why can't I reach 100% CPU utilization with my parallel tasks code?

淺唱寂寞╮ 提交于 2020-06-01 04:10:03
问题 private static async Task<int> SumParallel() { var intList = Enumerable.Range(1, 1000_000_000); int count = intList.Count(); int total = 0; for(int i = 1; i < 5; i++) { int skip = ((i - 1) * count) / 4; int take = count / 4; Interlocked.Add(ref total, await GetSum(intList, skip, take)); } return total; } private static async Task<int> GetSum(IEnumerable<int> list, int skip, int take) { return await Task.Run(() => { int temp = 0; foreach(int n in list.Skip(skip).Take(take)) { if (n % 2 == 0)

Why can't I reach 100% CPU utilization with my parallel tasks code?

自作多情 提交于 2020-06-01 04:08:25
问题 private static async Task<int> SumParallel() { var intList = Enumerable.Range(1, 1000_000_000); int count = intList.Count(); int total = 0; for(int i = 1; i < 5; i++) { int skip = ((i - 1) * count) / 4; int take = count / 4; Interlocked.Add(ref total, await GetSum(intList, skip, take)); } return total; } private static async Task<int> GetSum(IEnumerable<int> list, int skip, int take) { return await Task.Run(() => { int temp = 0; foreach(int n in list.Skip(skip).Take(take)) { if (n % 2 == 0)