|
Is it possible to force a thread to return from a call to a blocking function such as a blocking read from a stream ?
int x; std::cin >> x;
for example...
Started by yurib on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Syscall - if you only read when there's data waiting, you'll never block
Maybe try the istream::readsome (for whatever reason) the call may not return quickly enough, and you have a limited time of the query, start a timer which will....
|
|
Hi,
In a try/catch/finally block like:
try { } catch() { // code fails here } finally { }
So if there is an exception in the catch block, will finally always get called?
What if there is no finally, will the code after the catch block get run?
Started by Blankman on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Note that the original....
If there's no finally block, the exception from the catch block will just be thrown up the stack.
Assuming the process doesn't terminate abruptly (or hang, of course), the finally block will always be executed.
|
|
Is there a standard nice way to call a blocking method with a timeout in Java? I want to be able to do:
// call something.blockingMethod(); // if it hasn't come back within 2 seconds, forget it
if that makes sense.
Thanks.
Started by jjujuma on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
See http;Object>() { public Object call() { return something.blockingMethod(); } } Future<Object> future.
You could wrap the call in a FutureTask and use the timeout version of get().
|
Ask your Facebook Friends
|
Given I invoke an actor from inside react does this block the calling Actor or is it still processing other requests?
class worker extends Actor() { def act() = { loop { react { msg => var foo = another_actor !? 'bar' //Block here? println(foo) } }...
Started by Sebastian on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If it is invoke in middle of actor react block, the calling is a blocking call } case Result(args, result) => //now process this } }
Of course, the on-the-fly actor will....
Always blocks the calling thread.
|
|
Is it possible to write an application that will block incoming and outcoming phone calls? Or is the iPhone locked down too much? Thanks!
Started by Elliot on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
So I would like a jailbreak tool that says "these apps can block phone calls might get away....
Smaller, simplier phones had "block call interrupt my skype call.
I have an ex-husband, I want to block on my iPhone.
|
|
I want to block calls from few numbers, for that I want to write a app of my own. So what are the APIs which I should be using?
Basically I want to get notified when a call comes, i want to compare numbers if it is what i want to block, i want to cut ...
Started by Anurag Uniyal on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Refer to ....
It is Mission Impossible for the time being.
Otherwise I guess the documentation for 'Contacts' would be a good place to start looking .
That's already supported.
You could just re-direct specific numbers in your contacts to your voice-mail .
|
|
What happens if I have one socket, s , there is no data currently available on it, it is a blocking socket, and I call recv on it from two threads at once? Will one of the threads get the data? Will both get it? Will the 2nd call to recv return with an...
Started by Claudiu on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
One thread will get it, and there's no way sockets; it does not guarantee atomicity across a single call, and it doesn't promise any particular that's receiving TCP data streaming....
The other call should just block.
It becomes available.
|
|
Let's say there are three consecutive function calls in one try block and all of them throw the same type of exception. How can i figure out which function call threw the caught exception when handling it?
Started by Pushdown on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Or you take a look at the exception the obvious solutions tricky, perhaps the method call sites are a level or two down, or not at the same could subclass the object with....
You can put a try-catch block around every single method call.
|
|
In Perl, without using the Thread library, what is the simplest way to spawn off a system call so that it is non-blocking? Can you do this while avoiding fork() as well?
EDIT Clarification. I want to avoid an explicit and messy call to fork.
Started by Ross Rogers on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Do you mean like this?
system('my_command_which_will_not_block &');
As Chris Kloberdanz points out, this will call fork() implicitly -- there's really no other way for perl to do it; especially (usually bash) for execution, rather than running....
|
|
I'm doing a bunch of system calls that I want to run in parallel:
system(" sleep 5 && echo step 1 done &"); system(" sleep 3 && echo step 2 done &"); system(" sleep 7 && echo step 3 done &"); // block here
How can I block the program flow until all the...
Started by Ross Rogers on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
About running each one of the system call from a different thread and join on the threads
The easiest way to do this is probably to fork a new child process for each system call, and then wait for them.
|