mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 05:23:03 +01:00
Backport fix for race condition when two different events could use same instance of unused Rvnt.
Details at fb-devel, thread "Concurrency bugs in posting events?" by Mark Rotteveel. Thanks to Adriano for discovering issue.
This commit is contained in:
parent
40a7c45b27
commit
c2d3266fce
@ -917,17 +917,8 @@ public:
|
||||
if (!allowCancel)
|
||||
return;
|
||||
|
||||
if (event->rvnt_iface)
|
||||
if (!(port->port_flags & PORT_disconnect))
|
||||
{
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
event->rvnt_iface->cancel(&status_vector);
|
||||
event->rvnt_iface = NULL;
|
||||
}
|
||||
|
||||
if (port->port_flags & PORT_disconnect)
|
||||
return;
|
||||
|
||||
PACKET packet;
|
||||
packet.p_operation = op_event;
|
||||
P_EVENT* p_event = &packet.p_event;
|
||||
@ -939,6 +930,15 @@ public:
|
||||
port->send(&packet);
|
||||
}
|
||||
|
||||
if (event->rvnt_iface)
|
||||
{
|
||||
LocalStatus ls;
|
||||
CheckStatusWrapper status_vector(&ls);
|
||||
event->rvnt_iface->cancel(&status_vector);
|
||||
event->rvnt_iface = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int release()
|
||||
{
|
||||
if (--refCounter == 0)
|
||||
@ -4746,7 +4746,7 @@ ISC_STATUS rem_port::que_events(P_EVENT * stuff, PACKET* sendL)
|
||||
{
|
||||
if (!event->rvnt_iface)
|
||||
{
|
||||
event->rvnt_destroyed = 0;
|
||||
if (event->rvnt_destroyed.compareExchange(1, 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user