Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Semaphores failing to prevent race condition

by Llew_Llaw_Gyffes (Scribe)
on Mar 13, 2011 at 17:33 UTC ( [id://892965]=note: print w/replies, xml ) Need Help??


in reply to Re: Semaphores failing to prevent race condition
in thread Semaphores failing to prevent race condition

So possibly a single screen-interaction thread with messages passed to it via Thread::Queue, then?
  • Comment on Re^2: Semaphores failing to prevent race condition

Replies are listed 'Best First'.
Re^3: Semaphores failing to prevent race condition
by roboticus (Chancellor) on Mar 13, 2011 at 18:12 UTC

    Sure thing.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      I've been trying to figure out how I could do this, and while I'm not going to come right out and way that it can't be done in this way, it's going to be non-trivial. The inter-thread interface is going to be extremely complex, because while the listener and status threads simply print complete messages to the screen, the talker thread outputs one character at a time and does direct character positioning.

      However, what I can possibly do is have the talker thread be the thread that does all the screen I/O for the other threads, in between listening for keyboard events. This would eliminate the need to figure out how to send its readline-like events as messages, and would satisfy the goal of having all I/O occur in a single thread.

        Llew_Llaw_Gyffes:

        Yeah, it's often very difficult to change I/O in an application after it's done. I like your idea of using your talker thread to handle the I/O for other threads, especially because it's the one that outputs character-by-character, rather than complete messages.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://892965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found