2005-01-24 Dan Williams <dcbw@redhat.com>

* src/NetworkManagerDevice.c
	  src/NetworkManagerDevicePrivate.h
		- Block nm_device_new() until our device's worker thread has had a
			chance to start up.  Fixes a race between main thread and worker
			thread starting that caused activation requests to get lost.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@396 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2005-01-24 21:53:39 +00:00
parent 177b361b75
commit 2ba55c0e32
3 changed files with 22 additions and 1 deletions

View File

@@ -1,3 +1,11 @@
2005-01-24 Dan Williams <dcbw@redhat.com>
* src/NetworkManagerDevice.c
src/NetworkManagerDevicePrivate.h
- Block nm_device_new() until our device's worker thread has had a
chance to start up. Fixes a race between main thread and worker
thread starting that caused activation requests to get lost.
2005-01-24 Dan Williams <dcbw@redhat.com>
* initscript/RedHat/NetworkManager

View File

@@ -319,6 +319,12 @@ NMDevice *nm_device_new (const char *iface, const char *udi, gboolean test_dev,
dev = NULL;
}
/* Block until our device thread has actually had a chance to start. */
syslog (LOG_ERR, "nm_device_new(): waiting for device's worker thread to start.\n");
while (dev->worker_started == FALSE)
g_usleep (G_USEC_PER_SEC / 2);
syslog (LOG_ERR, "nm_device_new(): device's worker thread started, continuing.\n");
return (dev);
}
@@ -391,11 +397,17 @@ static gpointer nm_device_worker (gpointer user_data)
{
NMDevice *dev = (NMDevice *)user_data;
g_return_val_if_fail (dev != NULL, NULL);
if (!dev)
{
syslog (LOG_CRIT, "nm_device_worker(): received NULL device object, NetworkManager cannot continue.\n");
exit (1);
}
dev->context = g_main_context_new ();
dev->loop = g_main_loop_new (dev->context, FALSE);
dev->worker_started = TRUE;
/* Do an initial wireless scan */
if (nm_device_is_wireless (dev))
{

View File

@@ -104,6 +104,7 @@ struct NMDevice
GMainContext *context;
GMainLoop *loop;
gboolean worker_done;
gboolean worker_started;
guint renew_timeout;
guint rebind_timeout;