Get a Photon process to be a Resource Manager?

How can I get my Photon application to behave like a resource manager with attachments while still handling the user interface?

I’ve created an image processing platform based on collections of ResMgrs, therefore very flexible. Start the proper ResMgs, hook them up based on a resource manager attachment naming scheme and pump images through by writting to the first ResMgrs.

I would like to make some of these have a GUI and built in Photon. My ResMgs are built with the following snipet:

// Allocate a resource manager internal context block.
if ((g_sGlobals.g_psContext = resmgr_context_alloc (g_sGlobals.g_psDispatch)) == NULL)
{
return -6;
}
// Main message loop
while (1)
{
// Blocking on message receive
if ((g_sGlobals.g_psContext = resmgr_block(g_sGlobals.g_psContext)) == NULL)
{
slogf (_SLOG_SETCODE (_SLOG_SYSLOG, 0), _SLOG_ERROR,
“%s:resmgr_block - failed: %s”,
g_sGlobals.g_pcRootName, strerror (errno));
return -9;
}
// Handle path name request
resmgr_handler(g_sGlobals.g_psContext);
}

My Photon app calls PtMainLoop() for it’s message loop.

You have to make the resmgr a separate thread. That being said GUI should be client IMHO not server.

Thanks for the fast reply.

I tried adding the ResMgr message pump from the snipet above in a seperate thread, but the application will not run … it seems to fail with no dump. Any ideas?

I guess I could write a pair of programs each time, a GUI client and a ResMgr server, but that means two programs each time.

Using custom messages, your GUI program can get data from the resource manager. To get information synchronously, “when it occurs”, set up your GUI program to retrieve information when it gets a pulse from the resource manager.

As far as needing to write two programs, other than the communications, its the same amount of code. Since the functions (resource manager, user interface) are modularaized, its better design.

OK Guys … I summit to your suggestion and will make client GUIs for the resource manager.

Good idea. You can certainly have a Photon app running as a thread in your resmgr, but all this achieves is putting way more code in your resmgr (that is: way more code to have a bug in it). Separate address spaces are your friend…