task

How to make OpenMP thread or task run on a certain core

女生的网名这么多〃 提交于 2019-12-08 07:54:50
问题 Is there a way to make an OMP thread or task run on a certain core? I found this, followed the link, but I couldn't find the source code to test it. Also this is an Intel solution to it (I think). Does OMP support this itself? 回答1: As far as I know as of OpemMP 3.0 they're all vendor specific extensions. For example GOMP (GCC's implementation) honours the environment variable GOMP_CPU_AFFINITY for setting thread affinity. In their documentation they give the example: GOMP_CPU_AFFINITY="0 3 1

Erlang: what supervision tree should I end with writing a task scheduler?

巧了我就是萌 提交于 2019-12-08 07:06:55
问题 Mostly in educational purposes I'm trying to write a task (task is an open_port({spawn_executable, Command})) scheduler. I end up with the tree like supervisor | | scheduler receiver gen_event gen_event | supervisor | dispatcher gen_server | supervisor | | | task1 ... taskN In other words: top supervisor starts scheduler and receiver and makes sure they will be alive receiver starts middle supervisor middle supervisor starts dispatcher and makes sure it will be alive dispatcher starts bottom

Run multiply instances of the same method simultaneously in c# without data loss?

与世无争的帅哥 提交于 2019-12-08 06:46:21
问题 I really don't understand Tasks and Threads well. I have a method inside three levels of nested for that I want to run multiple times in different threads/tasks, but the variables I pass to the method go crazy, let me explain with some code: List<int> numbers=new List<int>(); for(int a=0;a<=70;a++) { for(int b=0;b<=6;b++) { for(int c=0;b<=10;c++) { Task.Factory.StartNew(()=>MyMethod(numbers,a,b,c)); } } } private static bool MyMethod(List<int> nums,int a,int b,int c) { //Really a lot of stuff

JavaFX multithreading - joining threads won't update the UI

我与影子孤独终老i 提交于 2019-12-08 04:44:55
问题 I am trying to make a loader dialog where the user can know that the program is loading what was requested and that the program is running as expected. But as so, I need to join() the parser thread and before keep going on the main and this makes the dialog blank. ParserTask.java public class ParserTask extends Task<Void>{ @Override protected Void call() throws Exception { for(int i=0;i<10;i++){ //parse stuff Thread.sleep(1000); updateProgress(i,9); updateMessage("foo no:"+ i); }

Delphi 10: Correct way to run tasks simultaneously

只愿长相守 提交于 2019-12-08 03:30:52
问题 I'm trying to learn how to use delphi parallel library instead of TThread. I have many tasks that I want to run simultaneously. Each task is most time waiting for some event, while its waiting, I'd like to pass excecution to another tasks. Here is my sample code: type TObj = class pos: integer; Done: boolean; Constructor Create; procedure DoWork(Sender: TObject); end; var Objects : array [0..39] of TObj; tasks : array of ITask; constructor TObj.Create; begin pos:=0; DOne:=false; end;

Why is an async method with await keyword still blocking the main thread?

两盒软妹~` 提交于 2019-12-08 03:09:47
问题 Can anyone explain to me the difference between these 2 async methods? Method A public async Task<List<Thumbnail>> GetAllThumbnailsAsync() { return await Task.Factory.StartNew(() => { var imageUris = GetAllDirectoriesWithImageAsync(CommandBaseUri).Result; return imageUris.Select(GetThumbnail).OrderByDescending(t => t.ImageDateTime).ToList(); }); } Method B public async Task<List<Thumbnail>> GetAllThumbnailsAsync() { var imageUris = await GetAllDirectoriesWithImageAsync(CommandBaseUri); return

How to add an ItemList to a default ItemDefinitionGroup metadata in MSBuild?

本小妞迷上赌 提交于 2019-12-08 02:47:35
问题 I'm trying to add all the files in a given directory to the ClCompile metadata's ForcedUsingFiles parameter. I'm using the following code: <ItemGroup> <ForcedUsingFilesList Include="c:\path\to\files\*" /> </ItemGroup> <ItemDefinitionGroup> <ClCompile> <ForcedUsingFiles>@(ForcedUsingFilesList)</ForcedUsingFiles> </ClCompile> </ItemDefinitionGroup> But I'm getting the error The value "@(ForcedUsingFilesList)" of metadata "ForcedUsingFiles" contains an item list expression. Item list expressions

How to kill an 3rd-app programmatically?

青春壹個敷衍的年華 提交于 2019-12-08 02:20:27
问题 How to kill an app in android? killPackageProcesses(services.get(i).baseActivity.getPackageName()); this is the function killPackageProcesses public void killPackageProcesses(String packagename) { int pid = 0; ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> pids = am .getRunningAppProcesses(); for (int i = 0; i < pids.size(); i++) { ActivityManager.RunningAppProcessInfo info = pids.get(i); if (info.processName

Asynchronous method in a C# class that executes a process

爷,独闯天下 提交于 2019-12-08 01:26:40
问题 I have a follow-up question to this post. In my version, I have the following I want to make asynchronous. Here is what I have: public virtual Task<bool> ExecuteAsync() { var tcs = new TaskCompletionSource<bool>(); string exe = Spec.GetExecutablePath(); string args = string.Format("--input1={0} --input2={1}", Input1, Input2); try { var process = new Process { EnableRaisingEvents = true, StartInfo = { UseShellExecute = false, FileName = exe, Arguments = args, RedirectStandardOutput = true,

Accessing grails application config from a quartz job

依然范特西╮ 提交于 2019-12-07 23:40:00
问题 Using grails 2.4.2, quartz:1.0.2, I'm trying to gain access to configuration properties class MyJob { def grailsApplication int propA def MyJob() { propA = grailsApplication.config.foo.bar.propAVal } ... } grailsApplication, however, doesn't get injected, and is null. Can't access any bean from Quartz Job in Grails supposedly relates to this, but I don't really see how the marked answer resolves the OP's question :-/ help? 10x 回答1: The problem is probably that you are accessing