I have a doubt .. ( maybe I don't know ..)
Let's say , we got the folowing example ( to understand better what I mean ).
We got two POSIX threads ( pthreads ) , one receives some strings and creates a menu ( for that strings , scrollable menu ) , and another one check's to see if it has to scroll the menu , or scroll down some strings.
I mean , the menu with strings is created in one pthread ( lets say it 1 ) , and simultanous checking if to scroll down strings or even menu is done is pthread 2 . How can pthread 2 know the location ( I mean pointer ) of the menu & window used in pthread 1 ? I mean a menu and a window are created in pthread 1 and fill out , at regular intervals , but I want pthread 2 to local variables used in pthread 1 to..
something like :
p1 = pthread_create(&thread1, NULL , Check, NULL);
p2 = pthread_create(&thread2, NULL , Receive ,NULL);
and ..
void *Check()
{
int c;
if (c = wgetch(wind)) == KEY_DOWN )
{
menu_driver(menu, REQ_DOWN_ITEM);
wrefresh(wind)
break;
}
...
}
and ..
void *Receive()
{
WINDOW *wind;
MENU *menu;
ITEM *item;
< create window wind and menu menu >
}
What I want ? I want Check void to use wind and menu from Receive .. Can I do this ( multithreading ) ?
Thanks in advance !