64-bit fix. Changed the user-supplied IDs used with
[AROS.git] / workbench / libs / workbench / unregisterworkbench.c
blob2327c16c85d2eb9d9ce5e86fb983c67642e48d06
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "workbench_intern.h"
7 #include <workbench/workbench.h>
9 /*****************************************************************************
11 NAME */
13 #include <proto/workbench.h>
15 AROS_LH1(BOOL, UnregisterWorkbench,
17 /* SYNOPSIS */
18 AROS_LHA(struct MsgPort *, messageport, A0),
20 /* LOCATION */
22 struct WorkbenchBase *, WorkbenchBase, 24, Workbench)
24 /* FUNCTION
25 The workbench application uses this functions to unregister itself
26 with the library. When it is done, messages will no longer be sent.
28 INPUTS
29 msgport - The message port of that was earlier passed in to
30 RegisterWorkbench().
32 RESULT
33 TRUE if the message port was successfully unregistered, FALSE otherwise.
34 The unregistration will fail if the message port isn't the same that
35 was passed in with RegisterWorkbench() earlier or if the passed
36 in pointer is NULL.
38 NOTES
39 Note that "Workbench Application" in this context means the program that
40 is the file manager and handles the GUI of Workbench, not a program that
41 is started from Workbench!
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 RegisterWorkbench()
50 INTERNALS
52 ******************************************************************************/
54 AROS_LIBFUNC_INIT
56 BOOL success = FALSE;
58 if (messageport != NULL)
60 ObtainSemaphore(&(WorkbenchBase->wb_WorkbenchPortSemaphore));
62 if (WorkbenchBase->wb_WorkbenchPort == messageport)
64 WorkbenchBase->wb_WorkbenchPort = NULL;
65 success = TRUE;
68 ReleaseSemaphore(&(WorkbenchBase->wb_WorkbenchPortSemaphore));
71 return success;
73 AROS_LIBFUNC_EXIT
74 } /* UnregisterWorkbench() */