I'm using Sysmac Studio v1.30 by Omron and wondered if there was any function to pause a task from the primary task?
I want to be able to pause a task after a security boolean variable turns true then continue with its operation after the boolean turn false.
Related
I spent some time but I can't find any info if it's allowed to call vTaskDelete from IRQ handler? I know some methods have specialized version for usage in IRQ routines however I can't find anything related to vTaskDelete. Currently it works but I don't want to do some hard to discover bug just because I didn't found info.
If you are calling a callback from the IRQ then it is still in the IRQ context. Calling vTaskDelete() with a NULL parameter would delete the task that was running before the interrupt was entered, so the interrupt would then try to return to a task that was no longer running. Even if that were not the case then the rule of thumb is not to use API functions that do not end in "FromISR" from an interrupt (the separate API ensures fewer decision points in the function, faster and standard interrupt entry as it doesn't need to keep an interrupt nesting variable, no need to pass parameters that don't make sense in an interrupt context [like a block time] into an interrupt function, etc.).
I assume you are not calling vTaskDelete with a NULL argument because there is no current task when you are in interrupt context. In any case vTaskDelete() should not be called from interrupt context. For example, it's implementation will call vPortFree() to free the TCB of the task.
I need to execute some tasks after grails transaction ends. I'm not looking for afterCommit of Hibernate, instead of that, I need a method to be called after the transaction of the service ends.
Is there any way? I've read the documentation but I couldn't find anything, just normal events like afterUpdate or afterCommit.
Thanks!
You can add an event listener to the current session
sessionFactory.currentSession.addEventListener(...)
class MyListener extends BaseSessionEventListener {
#Override
void transactionCompletion(boolean successful) {
}
}
You just need to verify the transaction was successful via the parameter. Also understand that if there are multiple transactions in a single session the listener will be invoked for each one.
That really depends on what you're trying to do. The best bet is probably to call a #Transactional method on a service, and then when that returns, run the code that you need to happen after the transaction.
An alternative, if you just want to spin off some task to do something simple, you can use:
new java.util.Timer().runAfter(1000) { //time in milliseconds
//code to run here
}
This is just a shortcut to spin off a new thread and runs the closure body after (in the above example) 1 second... I believe the closure still has access to injected grails objects, but does not have access to the session. I'd double-check that though. I've used this in several places for sending notifications that needed to wait until after some processing inside a transaction ended.
I have written a custom Task Event listener. In that on the After task added event I am changing some process variables.
How can i fetch process variables in Task event listeners ?
Any help is aprreciated.
Please consider passing the process variable as task variable through mapping so that process variable is available in the task context. Use the task variable mapped with the process variable inside task listener
I'm using IOmniParallelJoin to compute the several tasks in parallel with NoWait function because I want the GUI to stay responsive. But I also need to know when the computation is finished. Is there any event which is triggered in such case?
You can either use the OnStop function to inject some code or use a Task Configuration via TaskConfig and assign the code via OnTerminated. The difference is that OnStop is called inside one of the worker threads while OnTerminated is called inside the main thread.
In Blackberry's Application class what is the difference between hasEventThread() and isHandlingEvents(). I'm just curious, because I have only found hasEventThread useful.
From BB's docs for Applicaiton:
public boolean hasEventThread()
Determines if this application has entered the event dispatcher.
Returns:
True if this application has entered the event dispatcher (i.e. has invoked Application.enterEventDispatcher()); otherwise, false.
isHandlingEvents
public final boolean isHandlingEvents()
Determines if this application has entered the event dispatch loop.
Returns:
True if the application has entered the event dispatch loop; otherwise, false.
My only guess is that isHandlingEvents most happen sometime after hasEventThread. But is that really that useful?
They do exactly the same thing. I'm not sure why they both exist; probably legacy code and they possibly did different things in the past. But they've certainly converged as on now.