Can one class generate a signal and handled by another class?
I have a buffer in class 'bufferClass' that will generate a signal to tell 'fileClass' that buffer is full and now write data to file? And when 'fileClass' is done writing to file, it will generate a signal to tell 'guiClass' that data can be read from file开发者_如何转开发.
Is this possible? I have been reading http://www.gnu.org/s/libc/manual/html_node/Signal-Handling.html but not too sure how to generate such a signal? I don't need the exact code, just an idea.
Much appreciated.
i am using mac os X, x-code.
I would use threading.
By having your main class 'fileClass' spin off a thread called 'bufferclass'. When buffer class exits succesfully you will know that your buffer is full.
Intermediate thread url below http://www.cs.cf.ac.uk/Dave/C/node29.html
精彩评论