Implement an NX interface to block flush message queues in multi-user mode. This is necessary to prevent stale window handles when a window is closed

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4745 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-05-17 22:16:02 +00:00
parent 7c97dbdf44
commit 3d0f071c60
20 changed files with 959 additions and 84 deletions
+63
View File
@@ -190,6 +190,36 @@ struct nx_callback_s
#ifdef CONFIG_NX_KBD
void (*kbdin)(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, FAR void *arg);
#endif
/**************************************************************************
* Name: blocked
*
* Descripton:
* This callback is the response from nx_block (or nxtk_block). Those
* blocking interfaces are used to assure that no further messages are
* directed to the window. Receipt of the blocked callback signifies
* that (1) there are no further pending callbacks and (2) that the
* window is now 'defunct' and will receive no further callbacks.
*
* This callback supports coordinated destruction of a window in multi-
* user mode. In multi-use mode, the client window logic must stay
* intact until all of the queued callbacks are processed. Then the
* window may be safely closed. Closing the window prior with pending
* callbacks can lead to bad behavior when the callback is executed.
*
* Input Parameters:
* hwnd - Window handle of the blocked window
* arg - User provided argument (see nx_openwindow, nx_requestbkgd,
* nxtk_openwindow, or nxtk_opentoolbar)
*
* Returned Value:
* None
*
**************************************************************************/
#ifdef CONFIG_NX_MULTIUSER
void (*blocked)(NXWINDOW hwnd, FAR void *arg);
#endif
};
/****************************************************************************
@@ -434,6 +464,39 @@ EXTERN NXWINDOW nx_openwindow(NXHANDLE handle,
EXTERN int nx_closewindow(NXWINDOW hwnd);
/****************************************************************************
* Name: nx_block
*
* Description:
* This is callback will do to things: (1) any queue a 'blocked' callback
* to the window and then (2) block any further window messaging.
*
* The 'blocked' callback is the response from nx_block (or nxtk_block).
* Those blocking interfaces are used to assure that no further messages are
* are directed to the window. Receipt of the blocked callback signifies
* that (1) there are no further pending callbacks and (2) that the
* window is now 'defunct' and will receive no further callbacks.
*
* This callback supports coordinated destruction of a window in multi-
* user mode. In multi-use more, the client window logic must stay
* intact until all of the queued callbacks are processed. Then the
* window may be safely closed. Closing the window prior with pending
* callbacks can lead to bad behavior when the callback is executed.
*
* Multiple user mode only!
*
* Input Parameters:
* wnd - The window to be blocked
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
#ifdef CONFIG_NX_MULTIUSER
EXTERN int nx_block(NXWINDOW hwnd);
#endif
/****************************************************************************
* Name: nx_requestbkgd
*
+33
View File
@@ -150,6 +150,39 @@ EXTERN NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
EXTERN int nxtk_closewindow(NXTKWINDOW hfwnd);
/****************************************************************************
* Name: nxtk_block
*
* Description:
* This is callback will do to things: (1) any queue a 'blocked' callback
* to the window and then (2) block any further window messaging.
*
* The 'blocked' callback is the response from nx_block (or nxtk_block).
* Those blocking interfaces are used to assure that no further messages are
* are directed to the window. Receipt of the blocked callback signifies
* that (1) there are no further pending callbacks and (2) that the
* window is now 'defunct' and will receive no further callbacks.
*
* This callback supports coordinated destruction of a window in multi-
* user mode. In multi-use mode, the client window logic must stay
* intact until all of the queued callbacks are processed. Then the
* window may be safely closed. Closing the window prior with pending
* callbacks can lead to bad behavior when the callback is executed.
*
* Multiple user mode only!
*
* Input Parameters:
* hfwnd - The window to be blocked
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
#ifdef CONFIG_NX_MULTIUSER
EXTERN int nxtk_block(NXTKWINDOW hfwnd);
#endif
/****************************************************************************
* Name: nxtk_getposition
*