Arquivos
hhvm/hphp/runtime/ext/ext_ipc.h
T
Drew Paroski 84b9d9a3a2 Separate resources from objects, part 1
In HHVM (and HPHPc before it) we've been piggybacking resources on the
KindOfObject machinery. At the language level, resource is considered to
be a different type than object, and there are a number of differences
in behavior between objects and resources (ex. resources don't allow for
dynamic properties, resources don't work with the clone operator, the
"(object)" cast behaves differently for resources vs. objects, etc).

Piggybacking resources on the KindOfObject machinery has some downsides.
Code that deals with KindOfObject values often needs to check if the value
is a resource and go down a different code path. This makes things harder
to maintain and harder to keep parity with Zend. Also, these extra branches
hurt performance a little, and they make it harder for the JIT to do a good
job in some cases when its generating machine code that operates on objects.

This diff prepares the code base for a new KindOfResource type by adding a
new "Resource" smart pointer type (currently a typedef for the Object smart
pointer type) and it updates the C++ code and the idl files appropriately.
This diff is essentially a cosmetic change and should not impact run time
behavior. In the next diff (part 2) we'll actually add a new KindOfResource
type, detach ResourceData from the ObjectData inheritence hierarchy, and
provide a real implementation for the Resource smart pointer type (instead
of just aliasing the Object smart pointer type).
2013-07-10 11:16:33 -07:00

65 linhas
2.9 KiB
C++

/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_EXT_IPC_H_
#define incl_HPHP_EXT_IPC_H_
#include "hphp/runtime/base/base_includes.h"
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
// message queue
int64_t f_ftok(CStrRef pathname, CStrRef proj);
Variant f_msg_get_queue(int64_t key, int64_t perms = 0666);
bool f_msg_queue_exists(int64_t key);
bool f_msg_send(CResRef queue, int64_t msgtype, CVarRef message,
bool serialize = true, bool blocking = true,
VRefParam errorcode = uninit_null());
bool f_msg_receive(CResRef queue, int64_t desiredmsgtype, VRefParam msgtype,
int64_t maxsize, VRefParam message, bool unserialize = true,
int64_t flags = 0, VRefParam errorcode = uninit_null());
bool f_msg_remove_queue(CResRef queue);
bool f_msg_set_queue(CResRef queue, CArrRef data);
Array f_msg_stat_queue(CResRef queue);
///////////////////////////////////////////////////////////////////////////////
// semaphore
bool f_sem_acquire(CResRef sem_identifier);
Variant f_sem_get(int64_t key, int64_t max_acquire = 1, int64_t perm = 0666,
bool auto_release = true);
bool f_sem_release(CResRef sem_identifier);
bool f_sem_remove(CResRef sem_identifier);
///////////////////////////////////////////////////////////////////////////////
// shared memory
Variant f_shm_attach(int64_t shm_key, int64_t shm_size = 10000, int64_t shm_flag = 0666);
bool f_shm_detach(int64_t shm_identifier);
bool f_shm_remove(int64_t shm_identifier);
Variant f_shm_get_var(int64_t shm_identifier, int64_t variable_key);
bool f_shm_has_var(int64_t shm_identifier, int64_t variable_key);
bool f_shm_put_var(int64_t shm_identifier, int64_t variable_key, CVarRef variable);
bool f_shm_remove_var(int64_t shm_identifier, int64_t variable_key);
///////////////////////////////////////////////////////////////////////////////
}
#endif // incl_HPHP_EXT_IPC_H_