bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multi-threaded output


From: Steven Seeger
Subject: Re: Multi-threaded output
Date: Mon, 25 Oct 2004 16:19:39 -0700
User-agent: Microsoft-Entourage/11.0.0.040405

On 10/25/04 4:16 PM, "Thomas Dickey" <address@hidden> wrote:

Hi Thomas. Thanks for writing me back.
> 
> ncurses isn't thread-safe.  Occasionally someone asks about it, but no
> one's done any work to make this happen.

Not me. :)

> getch does a refresh.  If your other threads are running concurrently
> and updating the screen, it won't work.

Perhaps getch is corrupting my screen? I didn't put a mutex around it as I
didn't think I had to, as it blocks until input comes in, and the thread
that's drawing the screen has a higher priority than the one calling getch
so I figured the getch thread wouldn't run until the higher priority draw
one is finished.

> 
> If you added a mutex to refresh and getch, there's still the places
> that would update the screen (a lot of places).  Probably the simplest
> way to go would be to add an entrypoint to ncurses that provides the
> mutex, use that in blocks of code that would do updates.  That way
> you wouldn't be locking/unlocking things down at the character level.

What do you mean by add an entry point?

Steve





reply via email to

[Prev in Thread] Current Thread [Next in Thread]