MCPcopy Create free account
hub / github.com/F-Stack/f-stack / makeObjectShared

Function makeObjectShared

app/redis-6.2.6/src/object.c:69–73  ·  view source on GitHub ↗

Set a special refcount in the object to make it "shared": * incrRefCount and decrRefCount() will test for this special refcount * and will not touch the object. This way it is free to access shared * objects such as small integers from different threads without any * mutex. * * A common patter to create shared objects: * * robj *myobject = makeObjectShared(createObject(...)); * */

Source from the content-addressed store, hash-verified

67 *
68 */
69robj *makeObjectShared(robj *o) {
70 serverAssert(o->refcount == 1);
71 o->refcount = OBJ_SHARED_REFCOUNT;
72 return o;
73}
74
75/* Create a string object with encoding OBJ_ENCODING_RAW, that is a plain
76 * string object where o->ptr points to a proper sds string. */

Callers 1

createSharedObjectsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected