Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > SQL
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 29/05/2015
Casimiro Noteví's Avatar
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Join Date: Sep 2004
Location: En algún lugar.
Posts: 32,682
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
Quote:
The Lock Manager has been provided with the capability to cancel waiting, avoiding a condition whereby a transaction in WAIT mode could wait interminably for the end of another transaction that could not be achieved by either a DELETE FROM MON$xxx or an fb_cancel_operation request.
Quote:
Firebird 2.5: New API call to cancel operations

fb_cancel_operation() - new API call in firebird 2.5.
Implements capability to asynchronously cancel long running API call.
Author:
Alex Peshkoff <[email protected]>
Syntax is:
ISC_STATUS fb_cancel_operation(ISC_STATUS* status_vector,
isc_db_handle* db_handle,
ISC_USHORT option);
Description:
Action performed by this function depends upon value of last parameter, option. Option can be:
  • fb_cancel_raise: cancels any activity, related with db_handle. This means that firebird will as soon as possible (to be precise, at the nearest rescheduling point, except some special states of engine) try to stop running request and error-return to the user.
  • fb_cancel_disable: disable execution of fb_cancel_raise requests for given attachment. It's succesful when your program executes some critical things (for example, cleanup).
  • fb_cancel_enable: enables previously disabled cancel delivery.
  • fb_cancel_disable / fb_cancel_enable may be set many times - if engine is already in requested state, no action is taken. Cancel is enabled by default (i.e. after attach/create database).
Pay attention to asynchronous nature of this API call. Usually fb_cancel_raise is called when you need to stop long-running request. This means that it's called from separate thread (calling it from signal handler is bad idea, it's NOT async signal safe). Another side of asynchronous execution is that at the end of API call attachment's activity may be already cancelled, may be not (and the second is very possible). It also means that returned status vector will almost always be FB_SUCCESS, though some errors are possible (like error sending network packet to remote server).
Sample:
Thread A:
fb_cancel_operation(isc_status, &DB, fb_cancel_enable);
isc_dsql_execute_immediate(isc_status, &DB, &TR, 0, "long running statement", 3, NULL);
// waits for API call to finish...
Thread B:
fb_cancel_operation(local_status, &DB, fb_cancel_raise);
Thread A:
if (isc_status[1])
isc_print_status(isc_status); // will print "operation was cancelled"
http://ibsurgeon.com/en/articles/fir...el-operations/
Reply With Quote
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Es posible cambiar el evento del GetItemStyle del mxCalendar1 en modo ejecucion jeremiselxi Varios 0 22/01/2015 16:54
¿Es posible crear un botón en el formulario en tiempo de ejecución? kakarotv5 OOP 19 24/09/2008 16:50
Rave Report: Pierdo la ejecucion de mi programa al cancelar el "Generating"!!!! jbautista Impresión 1 22/08/2008 12:41
TdbNavigator cancelar la ejecucion en runtime camino OOP 2 07/07/2008 18:44
cancelar una consulta jmlifi SQL 1 08/11/2005 19:14


All times are GMT +2. The time now is 21:38.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi