Questions tagged [blocking]

Blocking mode I/O blocks the issuing thread until the operation transfers at least one byte or an error or end of stream occurs. Blocking algorithms refer to an operation in multithreaded environment which temporarily restricts access to some resources to a single thread, thus blocking all other ones. It isn't clear which this tag is intended for.

1679 questions
12
votes
3 answers

Blocking IO / Ruby on Rails

I'm contemplating writing a web application with Rails. Each request made by the user will depend on an external API being called. This external API can randomly be very slow (2-3 seconds), and so obviously this would impact an individual…
Matty
  • 33,203
  • 13
  • 65
  • 93
12
votes
3 answers

Implement a blocking function call in Java

What is the recommended / best way to implement a blocking function call in Java, that can be later unblocked by a call from another thread? Basically I want to have two methods on an object, where the first call blocks any calling thread until the…
mikera
  • 105,238
  • 25
  • 256
  • 415
12
votes
3 answers

What is a blocking function?

What is a blocking function or a blocking call? This is a term I see again and again when referring to Node.js or realtime processing languages.
cjm2671
  • 18,348
  • 31
  • 102
  • 161
12
votes
3 answers

Is making sequential HTTP requests a blocking operation in node?

Note that irrelevant information to my question will be 'quoted' like so (feel free to skip these). Problem I am using node to make in-order HTTP requests on behalf of multiple clients. This way, what originally took the client(s) several…
youngrrrr
  • 3,044
  • 3
  • 25
  • 42
12
votes
2 answers

C# Async Serial Port Read

I have a class which reads from the serial port using the DataReceived event handler in C#. When I receive data, I know the header will have 5 bytes, so I don't want to do anything with the data until I have at least that. My current code is…
mikeminer
  • 177
  • 1
  • 1
  • 10
12
votes
4 answers

C# : Blocking a function call until condition met

I am developing a C# Winforms application, part of the application will be uploading files to a webserver using AsyncUpload (using it,due to the need to use a porgress callback) , In the C# program i got a simple for loop that calls The Uploading…
Madi D.
  • 1,980
  • 5
  • 23
  • 44
12
votes
10 answers

How to get around an ISP block on port 25 for SMTP

Yes, this question has been answered in a variety of ways, none of which, are answered in a way that fit my needs. So, therefore I'm asking mine specific to my situation. I've tried, probably 5 or 6 different ways for setting up a mail (SMTP)…
TekGiant
  • 1,132
  • 3
  • 14
  • 29
12
votes
2 answers

What's the difference of Event and Lock in python threading module?

Does Event and Lock do the same thing in these scenes? class MyThread1(threading.Thread): def __init__(event): self.event = event def run(self): self.event.wait() # do something …
iMom0
  • 12,493
  • 3
  • 49
  • 61
11
votes
5 answers

c++ linux accept() blocking after socket closed

I have a thread that listens for new connections new_fd = accept(Listen_fd, (struct sockaddr *) & their_addr, &sin_size); and another thread that closes Listen_fd when when it's time to close the program. After Listen_fd is closed however, it…
BrandonToner
  • 111
  • 1
  • 1
  • 3
11
votes
4 answers

What are some reasons NetworkStream.Read would hang/block?

MSDN documentation seems to suggest that NetworkStream.Read will always return immediately. If no data is found it returns 0. However, I have some code that is currently deployed, that only in some cases (and I haven't figured out which ones yet),…
Mark
  • 5,223
  • 11
  • 51
  • 81
11
votes
1 answer

Haskell computationally intensive thread blocks all other threads

I want to write a program whose main thread forks a new thread for computation and waits on it to finish for a period of time. If the child thread does not finish in given time it is timed out and killed. I have the following code for this. import…
Random dude
  • 519
  • 2
  • 11
11
votes
2 answers

Dapper QueryAsync blocks UI for the first time querying (against Oracle server)?

Firstly I believe that the first time is just a condition to see this blocking more clearly. For next times, somehow it still blocks the UI slightly but not obvious like when not using async. I can say that because I can see the difference between…
Hopeless
  • 4,397
  • 5
  • 37
  • 64
11
votes
1 answer

Why cpu bound is better with blocking I/O and I/O bound is better with non blocking I/O

I have been told that for I/O bound applications, non blocking I/O would be better. For CPU bound applications, blocking I/O is much better. I could not find the reason for such a statement. Tried google, but few articles just touches the topic with…
piyushGoyal
  • 1,079
  • 1
  • 11
  • 26
11
votes
2 answers

Sending a sequence of commands and wait for response

I have to update firmware and settings on a device connected to a serial port. Since this is done by a sequence of commands, I send a command and wait until I recive an answer. Inside the answere (many lines) I search for a string that indicates if…
silversircel
  • 175
  • 1
  • 8
11
votes
9 answers

Callers block until getFoo() has a value ready?

I have a Java Thread which exposes a property which other threads want to access: class MyThread extends Thread { private Foo foo; ... Foo getFoo() { return foo; } ... public void run() { ... foo = makeTheFoo(); …
Sean Owen
  • 66,182
  • 23
  • 141
  • 173