|
| 1 | +------------------------------------------------------------------------------ |
| 2 | +-- Language Server Protocol -- |
| 3 | +-- -- |
| 4 | +-- Copyright (C) 2018-2021, AdaCore -- |
| 5 | +-- -- |
| 6 | +-- This is free software; you can redistribute it and/or modify it under -- |
| 7 | +-- terms of the GNU General Public License as published by the Free Soft- -- |
| 8 | +-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 9 | +-- sion. This software is distributed in the hope that it will be useful, -- |
| 10 | +-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- -- |
| 11 | +-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public -- |
| 12 | +-- License for more details. You should have received a copy of the GNU -- |
| 13 | +-- General Public License distributed with this software; see file -- |
| 14 | +-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy -- |
| 15 | +-- of the license. -- |
| 16 | +------------------------------------------------------------------------------ |
| 17 | +-- |
| 18 | +-- Each server request has an atomic flag to inform the handler that |
| 19 | +-- the request has been canceled. But, under a havy load, a frequent atomic |
| 20 | +-- checking cound generate overhead. This package provides a function to |
| 21 | +-- avoid an extra overhread by reducing atomic flag check frequency. |
| 22 | + |
| 23 | +with LSP.Messages.Server_Requests; |
| 24 | + |
| 25 | +generic |
| 26 | + Request : in out LSP.Messages.Server_Requests.Server_Request'Class; |
| 27 | + -- A request to check cancelation |
| 28 | + Max_Skip_Count : Natural; |
| 29 | + -- How much checks to skip before make a real atomic flag check |
| 30 | + |
| 31 | +package LSP.Generic_Cancel_Check is |
| 32 | + |
| 33 | + function Has_Been_Canceled return Boolean |
| 34 | + with Inline; |
| 35 | + |
| 36 | +end LSP.Generic_Cancel_Check; |
0 commit comments