Questions tagged [task]

A task is an abstraction that is used to work with concurrency, it can denote operation that should be executed concurrently with the rest of a program. A task is a concurrent thread of execution in Ada and represents an asynchronous operation in .NET, also it corresponds to Threads in Java.

Filter by
Sorted by
Tagged with
0 votes
1 answer
19 views

Problem with subtype usage in concurrent Ada program

I am working on a concurrent programming problem in Ada. The task is to simulate a bridge over which different cars can pass from different directions. The complication lies in the fact that, if an ...
Alejandro Moreno's user avatar
0 votes
1 answer
29 views

Are there any ways to actually stop awaited long-running asyncio Task?

If there is a long-running background task, cancel() method does not work as I expected (does not work at all). And I cannot find a way to actually stop the task, is that even possible or am I missing ...
Shpinks's user avatar
  • 21
0 votes
1 answer
74 views

How to Implement Continuous Read/Write with SerialPort in C# with Timeout Handling?

I'm working on a WPF application in C# on .NET 8.0 where I need to continuously read from and write to a serial port using the SerialPort class from the System.IO.Ports v8.0.0 NuGet package. I have ...
Fishayyy's user avatar
0 votes
0 answers
36 views

Parallel.ForEach + missing records [duplicate]

I have the below function which does a set of tasks: private async Task DoworkAsync(List<OrderFragment> of) { var sw = Stopwatch.StartNew(); var task = CreateOrderjson(of); await ...
Joe's user avatar
  • 19
-1 votes
0 answers
15 views

Turn off Windows on Idle

I'm trying to find a way to turn off Windows 11 EC2 when it's in idle state. It has to be from within the Windows and not from the EC2 console. I tried task scheduler to initiate shutdown script, but ...
Skynet's user avatar
  • 1
-4 votes
0 answers
50 views

How can I extract a parameter from the file? [closed]

enter image description here Hello. I didn't know how to edit this code. The json file contains information about continents and cities. I was asked to arrange the continents in alphabetical order. I ...
Sena Koç's user avatar
0 votes
0 answers
14 views

Error while updating google task - Error 400 - missing task id - Alexa Skill

I am generating an Alexa skill. While interacting with my tasks I got the following issue: GaxiosError: Missing task ID Reading the googleAPI documentation I know that I have to put the task id into ...
Greeves89's user avatar
1 vote
1 answer
14 views

How can i target a subset of ECS tasks for stop operation?

In my architecture, a single "job" may require N "tasks". A user can start a job, allow many tasks to begin, then later cancel the job all together. When this happens, i need to ...
Pandem1c's user avatar
  • 808
0 votes
0 answers
50 views

How to write iterator for task coroutine in C++?

I just learnt about Symmetric Transfer in C++ coroutines from Lewis Baker's Blog. This was a beautiful blog post and I wanted to try writing coroutines myself. I wrote my own implementation of ...
Aakash Gupta's user avatar
0 votes
1 answer
128 views

Routine to perform actions in Tasks, showing a loading screen, without freezing the main form

I'm looking to build a routine that is responsible for executing any action via procedure (Tproc) using Tasks, while displaying a loading screen, without freezing the system's main form. An extra ...
Rafael's user avatar
  • 3
1 vote
3 answers
102 views

What mechanism does an async button click handler maintain separate local variables for each invocation?

This code does what you would expect: Two clicks of the button in rapid succession will start two tasks and print two messages with two different local variable values. private bool _dummy; ...
amonroejj's user avatar
  • 603
1 vote
1 answer
51 views

Awaiting foreign tasks - warning VSTHRD003

Lets say I have a startable class that have StartAsync and StopAsync. When StopAsync is called the method wait until are necessary tasks are finished and handled properly (Writing some things to db ...
Jerrod Wynne's user avatar
1 vote
1 answer
93 views

ACR task for cleanup avoiding specific tags giving syntax error

I'm trying to create ACR tasks that would run acr purge command to cleanup of ACR registry. Here is a command for ACR cleanup of 3 repositories, except those with the tag latest : az acr run --cmd '...
AnjK's user avatar
  • 3,047
0 votes
1 answer
92 views

How to generalize async methods with delegate parameters in C# to reduce redundant code?

I have some async methods I want to try a set number of times until they return true or the max attempts have been reached, with a delay in between. I've been able to get the outcome I desire, but ...
Samhain323's user avatar
1 vote
1 answer
61 views

Why does the thread run only once - open and close windows?

I am trying to open the "Loading" window while logging into the program. Everything works correctly only once. The second time I run it, I get the error: System.InvalidOperationException: ...
McStar's user avatar
  • 11
0 votes
1 answer
71 views

Waiting for all tasks to complete in Threadpool

I need help with this code, so if anyone is willing to help I would be grateful. I'm working on developing a simple thread pool, which is passed an array of numbers, and the threads compute the ...
SP222's user avatar
  • 1
0 votes
0 answers
25 views

asyncio.Task cancel() does not cancel the task if it's not in event loop [duplicate]

I've stumbled upon a rather counterintuitive behavior of Python. Version is 3.10.12, Ubuntu 22.04. Consider this script: import asyncio async def main(): t = asyncio.create_task(asyncio.sleep(5)) ...
winwin's user avatar
  • 1,068
-1 votes
0 answers
14 views

How to identify the name of an app in task manager from an app without using brute force

I have a brand new Lenovo laptop. There is a default application that pops up every time I boot the computer. It does NOT appear in "startup applications". I want the software utility that ...
alexjedynak's user avatar
-2 votes
1 answer
67 views

Locking behaviour when dealing with async/await [closed]

I might be overthinking this, but I'm not sure I understand how locking works when dealing with await/async. Given the following, after each await a different thread can return to execute the next bit ...
creativergk's user avatar
1 vote
0 answers
60 views

Queueing tasks to run one after the other

I have a scenario where I want to perform a long running operation as task on a worker thread, to produce a result that will be displayed on the UI thread. However, the service being used for the long ...
creativergk's user avatar
0 votes
0 answers
12 views

Can and should I use JS AbortController like .NET CancellationToken?

I recently found out about AbortController and its sibling AbortSignal to register event listeners until I don't want it anymore. When I look at the documentation, it looks surprisingly similar to ....
Luke Vo's user avatar
  • 18.6k
0 votes
0 answers
25 views

Query to find Root Task for each Task in Snowflake?

Snowflake has a 'Task_Dependents' function which will return the root task of a single task specified. However, I want to quickly find the root task (and therefore schedule) of about 1200 tasks in our ...
user45867's user avatar
  • 899
1 vote
2 answers
70 views

Strange deadlock while sync with TaskCompletionSource and AutoResetEvent

While running the following C# program, I randomly got two different results. Result 1 (occurred frequently) is actually deadlocked. Please explain to me why this happened. I am not expecting the ...
Sky Nano's user avatar
-1 votes
0 answers
57 views

How to cancel waiting on COM object creation within STA thread?

I'm using third party COM api. Therefore, I have STA thread that creates COM object. The problem is that the creation of the object new IThirdPartyClass() can take minute or so. I want to be able to ...
theateist's user avatar
  • 14k
0 votes
0 answers
98 views

I want to run this in task scheduler

wmic product where "name like 'Forti%%'" call uninstall /nointeractive I tried to run this without reboot but it would not uninstall the program. wmic product where "name like 'Forti%%'...
oryxway's user avatar
  • 31
-1 votes
0 answers
44 views

Concurrency Issue in Windows Service: Multiple threads accessing same ProductID

I have a Windows service implemented in C# that fetches ProductIDs from a database and processes them concurrently using multiple threads. I've encountered a problem where multiple threads are ...
Luke's user avatar
  • 159
-1 votes
1 answer
68 views

Airflow - how to define task dependencies between DummyOperators and task group - using decorators syntax

I am going through Airflow documentation and documentation from https://docs.astronomer.io/learn/managing-dependencies?tab=taskflow#dependencies-in-dynamic-task-mapping to try new features coming with ...
punky's user avatar
  • 123
1 vote
1 answer
99 views

Implementing Tasks, await and async for background work

I am new to Tasks and its associated keywords in C#. My goal is to setup a background thread/task that will continuously poll a server every n seconds. Using the .NET TPL library, is the following ...
Lanet Rino's user avatar
2 votes
3 answers
106 views

Proper way to use the do! keyword to await a Task<'a>

I'm using F# to interoperate with async C# classes. I have a case where I need to call a method that returns a generic Task<'a>, and asynchronously wait for it to complete, and then ignore the ...
karanveer41's user avatar
1 vote
2 answers
113 views

Propagating ValueTask to callers

Say I have a method signature like this: public async ValueTask<int> GetSomeValueAsync(int number); Internally it may make an async HTTP call but it caches the result so next time it is called ...
millie's user avatar
  • 2,712
3 votes
0 answers
59 views

JBPM assign task to a specific user

I need to assign a task to a specific user. Let me explain by an example In this process the task has a POTENTIENTIAL_OWNER 'GROUP1'. User 'JOHN' of GROUP1 work the task 'TASK' and ask to execute the ...
Francesco Motta's user avatar
0 votes
1 answer
24 views

How to send a job to nodes of different types in SLURM

I work at a HPC centre where we use SLURM to manage queues and I'm looking for a way to force a job divided by tasks to be sent to nodes of different types. For example, let's say we have two types of ...
Willy's user avatar
  • 1
-1 votes
0 answers
84 views

Running asynchronous code synchronously in .NET [duplicate]

I know that it should be avoided at all costs, but sometimes, it just needs to happen: we need to run asynchronous code synchronously. What I would like to know is if there any differences and/or if ...
Ricardo Peres's user avatar
0 votes
2 answers
141 views

What's the difference between Task.Run and async Task in this context? [duplicate]

Could someone please explain to me what is the difference in the behaviour of the two code samples below? Which one is better/safer? This is a snippet from a Repository implementation. Task.Run ...
Tyrel's user avatar
  • 91
0 votes
1 answer
85 views

Why isn't Task.WhenAll waiting until completion?

I'm running into an issue here and you might know the answer: I just couldn't figure it out still. I'm creating a seed for a simple scenario here: adding likes to a given post. The method signature is:...
Kiwanax's user avatar
  • 1,305
0 votes
0 answers
93 views

Why Microsoft doesn't use async/await in source code? [duplicate]

In this link I can see the implementation of the HttpClient.PutAsync method: public Task<HttpResponseMessage> PutAsync(Uri requestUri, HttpContent content, CancellationToken ...
Farhad Zamani's user avatar
0 votes
0 answers
42 views

ContinueWith method doesn't run some code but other yes

I have a task object that downloads some stuff from the azure blob, in this case an exe. I want to trigger the end of the download to open the .exe automatically. I found that the ContinueWith method ...
fed's user avatar
  • 9
0 votes
0 answers
24 views

Run or keep a custom function alive even after the app is fully closed [Closed even from the recent tabs] - Android Studio [duplicate]

Suppose, I have a function which continuously checks if a item is available or not and I am trying to find a way which would keep the function alive even after the app is fully closed using java - ...
Marzanur Zarif's user avatar
0 votes
0 answers
14 views

How to trigger gradle task assembleAndroidTest twice in the gradle with custom task or plugin with different input parameters?

I need to build android test APK twice with different appId for library project. After that I can submit 2 APKs to Firebase Test Lab as the test apk and application apk. To achieve that I wish to run ...
Andrii Volynets's user avatar
0 votes
1 answer
64 views

.NET TPL: Why is delegate being ran like it was executed with blocking wait call?

When I'm trying to run Task.Run method with delegate which runs another task without blocking call it's being ran like my task was exectued with Wait blocking call? Here is an example: I'm trying to ...
Stanislau Viaroukin's user avatar
1 vote
2 answers
99 views

Run multiple task in background service in .NET Core with different timer duration

I'm using the BackgroundService - is it possible to have multiple task in one background service project in .NET Core with different timer duration: FirstLoop - execute every second SecondLoop - ...
NDym's user avatar
  • 91
0 votes
1 answer
63 views

Is there a way to programatically obtain the Task Manager "Users" tab?

The Windows Task Manager (taskmgr.exe) has a Users tab that displays a table of user names, session status, total CPU % usage and total memory usage. Is there a way to obtain this data programatically ...
tjlds's user avatar
  • 1
0 votes
0 answers
21 views

Invalid value for '-A' / '--app': Unable to load celery application. 'str' object has no attribute 'level' when Integrating Celery with Flask?

In order to issue long running task like deleting posts in background job, I decided to integrate Celery with Flask as a new beginner according to flask official tutorial at Background Tasks with ...
JTPing's user avatar
  • 1
1 vote
2 answers
82 views

Has ContinueWith()'s body a chance of being invoked before ContinueWith() returns the related Task?

I have a synchronized Task list populated, for monitoring purposes. I want to progressively remove the completed tasks from the list. To do so I resolved to use Continuation tasks like so: //remove ...
Andrea Bardelli's user avatar
0 votes
3 answers
155 views

Best way to parallelize .NET tasks with Task.WhenAll

I have a program which needs to execute the following instructions: Retrieve via a Http request a list of items For every retrieved item, execute another Http request with that item as parameter For ...
Zenith's user avatar
  • 146
0 votes
0 answers
24 views

A task using django/heroku scheduler do nothing [duplicate]

I have used heroku to deploy using python-django. Following heroku documentation, i installed scheduler, create a python scrypt(tarefas.py), but nothing happened. the log show status 0. this is the ...
Carlos Gobbo's user avatar
1 vote
1 answer
98 views

Wrap async Task function call in a Task [duplicate]

I have an asynchronous function, for simplicity, let's have it be this: static async Task TestTask(object? _) { Console.WriteLine("2"); await Task.Delay(500); Console.WriteLine(&...
Lucas Stertz's user avatar
0 votes
1 answer
76 views

Start 3 Tasks exactly at the same time milliseconds precision

in my WPF App i have 3 tasks which i would like to start all at the same time at t=0. When a Start button is pressed the function Start_Click() is executed which starts the three tasks and writes the ...
RBCSharp's user avatar
0 votes
0 answers
13 views

Task Scheduler run process after another process has run n-times

i have two programs A and B, and i need to run A, A, B, where each process should start directly after the previous process has finished. Now i am aware of how to implement the A, A or A, B logic via ...
user2550228's user avatar
1 vote
2 answers
104 views

What is the best way to create a background Task for an ILogger

I created a File ILogger provider. It has a background task that does the actual writing to disk so that a Log() call is not waiting for a disk write to complete. What is the best way to create/manage ...
David Thielen's user avatar

1
2 3 4 5
171