[Scala]: Problem with Actors and blocking IO
I'm having a little problem with Scala Actors and blocking IO. I'm using an actor that itself has an anonymous actor that consumes an input stream. The problem is that this stream only reads one line and then blocks without waking up again. What confuses me is that it worked when the consumption took place in the act method (coincidence?). The application itself has some more actors and java threads doing some work.

My question is: What is the common practice to avoid such problems? Any pointers?

The code that causes this problem looks somewhat like this:

    object TestActor extends Actor {
    
      private val instream = actor {
        loop {
          try {
            println(processInput(input.readLine)) //bufferedinputstream. blocks, no wakeup
          } catch {
            case e: Exception =>
              println(e.toString)
          }
        }
      }
    

      def act(): Unit = {
        react {
          ...
          case _ => {}
        }
      }
    }

Regards,
raichoo

[Scala]: Problem with Actors and blocking IO
===

I'm having a little problem with Scala Actors and blocking IO. I'm using an actor that itself has an anonymous actor that consumes an input stream. The problem is that this stream only reads one line and then blocks without waking up again. What confuses me is that it worked when the consumption took place in the act method (coincidence?). The application itself has some more actors and java threads doing some work.

My question is: What is the common practice to avoid such problems? Any pointers?

The code that causes this problem looks somewhat like this:

    object TestActor extends Actor {
    
      private val instream = actor {
        loop {
          try {
            println(processInput(input.readLine)) //bufferedinputstream. blocks, no wakeup
          } catch {
            case e: Exception =>
              println(e.toString)
          }
        }
      }
    

      def act(): Unit = {
        react {
          ...
          case _ => {}
        }
      }
    }

Regards,
raichoo
