add pid to event names

ulab-original
jsorg71 16 years ago
parent ffee44d518
commit 9317386e74

@ -1864,14 +1864,13 @@ g_exit(int exit_code)
}
/*****************************************************************************/
/* does not work in win32 */
int APP_CC
g_getpid(void)
{
#if defined(_WIN32)
return 0;
return (int)GetCurrentProcessId();
#else
return getpid();
return (int)getpid();
#endif
}

@ -204,6 +204,8 @@ VOID WINAPI
MyServiceMain(DWORD dwArgc, LPTSTR* lpszArgv)
{
WSADATA w;
char text[256];
int pid;
//HANDLE event_han;
// int fd;
// char text[256];
@ -218,8 +220,11 @@ MyServiceMain(DWORD dwArgc, LPTSTR* lpszArgv)
WSAStartup(2, &w);
g_sync_mutex = tc_mutex_create();
g_sync1_mutex = tc_mutex_create();
g_term_event = g_create_wait_obj("xrdp_main_term");
g_sync_event = g_create_wait_obj("xrdp_main_sync");
pid = g_getpid();
g_snprintf(text, 255, "xrdp_%8.8x_main_term", pid);
g_term_event = g_create_wait_obj(text);
g_snprintf(text, 255, "xrdp_%8.8x_main_sync", pid);
g_sync_event = g_create_wait_obj(text);
g_memset(&g_service_status, 0, sizeof(SERVICE_STATUS));
g_service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
g_service_status.dwCurrentState = SERVICE_RUNNING;
@ -275,7 +280,7 @@ main(int argc, char** argv)
int pid;
int fd;
int no_daemon;
char text[32];
char text[256];
#endif
g_init();
@ -567,8 +572,11 @@ main(int argc, char** argv)
g_signal(15, xrdp_shutdown); /* SIGTERM */
g_sync_mutex = tc_mutex_create();
g_sync1_mutex = tc_mutex_create();
g_term_event = g_create_wait_obj("xrdp_main_term");
g_sync_event = g_create_wait_obj("xrdp_main_sync");
pid = g_getpid();
g_snprintf(text, 255, "xrdp_%8.8x_main_term", pid);
g_term_event = g_create_wait_obj(text);
g_snprintf(text, 255, "xrdp_%8.8x_main_sync", pid);
g_sync_event = g_create_wait_obj(text);
if (g_term_event == 0)
{
g_writeln("error creating g_term_event");

@ -32,9 +32,13 @@ struct xrdp_listen* APP_CC
xrdp_listen_create(void)
{
struct xrdp_listen* self;
int pid;
char text[256];
pid = g_getpid();
self = (struct xrdp_listen*)g_malloc(sizeof(struct xrdp_listen), 1);
self->pro_done_event = g_create_wait_obj("xrdp_listen_pro_done_event");
g_snprintf(text, 255, "xrdp_%8.8x_listen_pro_done_event", pid);
self->pro_done_event = g_create_wait_obj(text);
self->process_list = list_create();
if (g_process_sem == 0)
{

@ -30,15 +30,17 @@ struct xrdp_process* APP_CC
xrdp_process_create(struct xrdp_listen* owner, tbus done_event)
{
struct xrdp_process* self;
char event_name[64];
char event_name[256];
int pid;
self = (struct xrdp_process*)g_malloc(sizeof(struct xrdp_process), 1);
self->lis_layer = owner;
self->done_event = done_event;
g_session_id++;
self->session_id = g_session_id;
g_snprintf(event_name, 63, "xrdp_process_self_term_event_%8.8x",
self->session_id);
pid = g_getpid();
g_snprintf(event_name, 255, "xrdp_%8.8x_process_self_term_event_%8.8x",
pid, self->session_id);
self->self_term_event = g_create_wait_obj(event_name);
return self;
}

@ -28,7 +28,8 @@ xrdp_wm_create(struct xrdp_process* owner,
struct xrdp_client_info* client_info)
{
struct xrdp_wm* self;
char event_name[64];
char event_name[256];
int pid;
self = (struct xrdp_wm*)g_malloc(sizeof(struct xrdp_wm), 1);
self->client_info = client_info;
@ -39,8 +40,9 @@ xrdp_wm_create(struct xrdp_process* owner,
self->screen->wm = self;
self->pro_layer = owner;
self->session = owner->session;
g_snprintf(event_name, 63, "xrdp_wm_login_mode_event_%8.8x",
owner->session_id);
pid = g_getpid();
g_snprintf(event_name, 255, "xrdp_%8.8x_wm_login_mode_event_%8.8x",
pid, owner->session_id);
self->login_mode_event = g_create_wait_obj(event_name);
self->painter = xrdp_painter_create(self, self->session);
self->cache = xrdp_cache_create(self, self->session, self->client_info);

Loading…
Cancel
Save