dvander@247: /** ds@475: * vim: set ts=4 : ds@1330: * ============================================================================= ds@1947: * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. ds@1330: * ============================================================================= ds@1330: * ds@1330: * This file is part of the SourceMod/SourcePawn SDK. dvander@374: * ds@1330: * This program is free software; you can redistribute it and/or modify it under ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the ds@1330: * Free Software Foundation. ds@1330: * ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ds@1330: * details. ds@1330: * ds@1330: * You should have received a copy of the GNU General Public License along with ds@1330: * this program. If not, see . ds@1330: * ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants ds@1330: * this exception to all derivative works. AlliedModders LLC defines further ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), ds@1330: * or . dvander@374: * dvander@374: * Version: $Id$ dvander@247: */ dvander@247: dvander@247: #if defined _handles_included dvander@247: #endinput dvander@247: #endif dvander@247: #define _handles_included dvander@247: dvander@619: /** dvander@619: * Handle helper macros. dvander@619: */ dvander@247: enum Handle dvander@247: { dvander@247: INVALID_HANDLE = 0, dvander@247: }; dvander@247: dvander@247: dvander@247: /** dvander@812: * Closes a Handle. If the handle has multiple copies open, dvander@247: * it is not destroyed unless all copies are closed. dvander@247: * dvander@247: * @note Closing a Handle has a different meaning for each Handle type. Make dvander@247: * sure you read the documentation on whatever provided the Handle. dvander@247: * dvander@247: * @param hndl Handle to close. ds@475: * @return True if successful, false if not closeable. dvander@247: * @error Invalid handles will cause a run time error. dvander@247: */ dvander@247: native bool:CloseHandle(Handle:hndl); dvander@247: dvander@247: /** dvander@812: * Clones a Handle. When passing handles in between plugins, caching handles dvander@247: * can result in accidental invalidation when one plugin releases the Handle, or is its owner dvander@247: * is unloaded from memory. To prevent this, the Handle may be "cloned" with a new owner. dvander@247: * dvander@247: * @note Usually, you will be cloning Handles for other plugins. This means that if you clone dvander@247: * the Handle without specifying the new owner, it will assume the identity of your original calling dvander@247: * plugin, which is not very useful. You should either specify that the receiving plugin should dvander@247: * clone the handle on its own, or you should explicitly clone the Handle using the receiving plugin's dvander@247: * identity Handle. dvander@247: * dvander@247: * @param hndl Handle to clone/duplicate. dvander@247: * @param plugin Optional Handle to another plugin to mark as the new owner. ds@475: * If no owner is passed, the owner becomes the calling plugin. ds@475: * @return Handle on success, INVALID_HANDLE if not cloneable. dvander@247: * @error Invalid handles will cause a run time error. dvander@247: */ dvander@247: native Handle:CloneHandle(Handle:hndl, Handle:plugin=INVALID_HANDLE); dvander@1398: dvander@1398: /** dvander@1398: * Do not use this function. Returns if a Handle and its contents dvander@1398: * are readable, whereas INVALID_HANDLE only checks for the absence dvander@1398: * of a Handle. dvander@1398: * dvander@1398: * This function is intended only for tests where the validity of a dvander@1398: * Handle can absolutely not be known. dvander@1398: * dvander@1398: * Do not use this to check the return values of functions, or to dvander@1398: * check if timers should be closed (except in very rare cases). dvander@1398: * This function is for very specific usage and using it for general dvander@1398: * purpose routines can and will hide very subtle bugs. dvander@1398: * dvander@1398: * @param hndl Handle to test for validity. dvander@1398: * @return True if handle is valid, false otherwise. dvander@1398: */ dvander@1765: #pragma deprecated Do not use this function. dvander@1398: native bool:IsValidHandle(Handle:hndl);