Subversion Repositories mdb

Rev

Rev 58 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 58 Rev 59
Line 66... Line 66...
66
	/* Now daemonize this application */
66
	/* Now daemonize this application */
67
	daemon_start(1);
67
	daemon_start(1);
68
	changeToUser(&configs.User[0], &configs.Grp[0]);
68
	changeToUser(&configs.User[0], &configs.Grp[0]);
69
	handleInit();
69
	handleInit();
70
 
70
 
-
 
71
	// Prepare the thread attributes
-
 
72
	if (pthread_attr_init(&pattr) != 0)
-
 
73
	{
-
 
74
		syslog(LOG_DAEMON,"Error getting thread attributes.");
-
 
75
		return FALSE;
-
 
76
	}
-
 
77
	
-
 
78
	if (pthread_attr_setdetachstate(&pattr, PTHREAD_CREATE_DETACHED) != 0)
-
 
79
	{
-
 
80
		syslog(LOG_DAEMON,"Error setting thread attributes.");
-
 
81
		return FALSE;
-
 
82
	}
-
 
83
 
71
	/* Now start our Thread */
84
	/* Now start our Thread */
72
	if (pthread_create(&pthr_pars, NULL, pthr_parser, (void *)0) != 0)
85
	if (pthread_create(&pthr_pars, &pattr, pthr_parser, (void *)0) != 0)
73
	{
86
	{
74
		syslog (LOG_DAEMON, "Create of thread \"pthr_parser\" failed!");
87
		syslog (LOG_DAEMON, "Create of thread \"pthr_parser\" failed!");
75
		return 1;
88
		return 1;
76
	}
89
	}
77
 
90
 
Line 275... Line 288...
275
		syslog (LOG_INFO, "Connected to client %s", str);
288
		syslog (LOG_INFO, "Connected to client %s", str);
276
		soc.sockfd = s;
289
		soc.sockfd = s;
277
		soc.newfd = s1;
290
		soc.newfd = s1;
278
 
291
 
279
		/* start a new thread to parse the commands */
292
		/* start a new thread to parse the commands */
280
		if (pthread_create(&pthr_cmds, NULL, processCommands, (void *)&soc) != 0)
293
		if (pthread_create(&pthr_cmds, &pattr, processCommands, (void *)&soc) != 0)
281
		{
294
		{
282
			syslog (LOG_DAEMON,"Creation of thread \"pthr_cmds\" failed!");
295
			syslog (LOG_DAEMON,"Creation of thread \"pthr_cmds\" failed!");
283
			close(s1);
296
			close(s1);
284
			close(s);
297
			close(s);
285
			pthread_exit(NULL);
298
			pthread_exit(NULL);