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:
@@ -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>
|
2005-01-24 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* initscript/RedHat/NetworkManager
|
* initscript/RedHat/NetworkManager
|
||||||
|
@@ -319,6 +319,12 @@ NMDevice *nm_device_new (const char *iface, const char *udi, gboolean test_dev,
|
|||||||
dev = NULL;
|
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);
|
return (dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,11 +397,17 @@ static gpointer nm_device_worker (gpointer user_data)
|
|||||||
{
|
{
|
||||||
NMDevice *dev = (NMDevice *)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->context = g_main_context_new ();
|
||||||
dev->loop = g_main_loop_new (dev->context, FALSE);
|
dev->loop = g_main_loop_new (dev->context, FALSE);
|
||||||
|
|
||||||
|
dev->worker_started = TRUE;
|
||||||
|
|
||||||
/* Do an initial wireless scan */
|
/* Do an initial wireless scan */
|
||||||
if (nm_device_is_wireless (dev))
|
if (nm_device_is_wireless (dev))
|
||||||
{
|
{
|
||||||
|
@@ -104,6 +104,7 @@ struct NMDevice
|
|||||||
GMainContext *context;
|
GMainContext *context;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
gboolean worker_done;
|
gboolean worker_done;
|
||||||
|
gboolean worker_started;
|
||||||
guint renew_timeout;
|
guint renew_timeout;
|
||||||
guint rebind_timeout;
|
guint rebind_timeout;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user