Example #1
0
static ScmObj cv_allocate(ScmClass *klass, ScmObj initargs)
{
    ScmConditionVariable *cv = SCM_NEW_INSTANCE(ScmConditionVariable, klass);
    SCM_INTERNAL_COND_INIT(cv->cv);
    Scm_RegisterFinalizer(SCM_OBJ(cv), cv_finalize, NULL);
    cv->name = SCM_FALSE;
    cv->specific = SCM_UNDEFINED;
    return SCM_OBJ(cv);
}
Example #2
0
ScmObj Scm_MakeTLS(uint32_t options, int num_sessions)
{
    ScmTLS* t = SCM_NEW(ScmTLS);
    SCM_SET_CLASS(t, SCM_CLASS_TLS);
#if defined(GAUCHE_USE_AXTLS)
    t->ctx = ssl_ctx_new(options, num_sessions);
    t->conn = NULL;
    t->in_port = t->out_port = 0;
#endif /*GAUCHE_USE_AXTLS*/
    Scm_RegisterFinalizer(SCM_OBJ(t), tls_finalize, NULL);
    return SCM_OBJ(t);
}
Example #3
0
static ScmObj mutex_allocate(ScmClass *klass, ScmObj initargs)
{
    ScmMutex *mutex = SCM_NEW_INSTANCE(ScmMutex, klass);
    SCM_INTERNAL_MUTEX_INIT(mutex->mutex);
    SCM_INTERNAL_COND_INIT(mutex->cv);
    Scm_RegisterFinalizer(SCM_OBJ(mutex), mutex_finalize, NULL);
    mutex->name = SCM_FALSE;
    mutex->specific = SCM_UNDEFINED;
    mutex->locked = FALSE;
    mutex->owner = NULL;
    mutex->locker_proc = mutex->unlocker_proc = SCM_FALSE;
    return SCM_OBJ(mutex);
}
Example #4
0
File: net.c Project: qyqx/Gauche
ScmSocket *make_socket(Socket fd, int type)
{
    ScmSocket *s = SCM_NEW(ScmSocket);
    SCM_SET_CLASS(s, SCM_CLASS_SOCKET);
    s->fd = fd;
    s->status = SCM_SOCKET_STATUS_NONE;
    s->inPort = s->outPort = NULL;
    s->address = NULL;
    s->name = NULL;
    s->type = type;
#if defined(GAUCHE_WINDOWS)
    s->cfd = -1;
#endif /*GAUCHE_WINDOWS*/
    Scm_RegisterFinalizer(SCM_OBJ(s), socket_finalize, NULL);
    return s;
}
Example #5
0
File: tls.c Project: Z-Shang/Gauche
ScmObj Scm_MakeTLS(void)
{
    ScmTLS* t = SCM_NEW(ScmTLS);
    SCM_SET_CLASS(t, SCM_CLASS_TLS);
#if defined(GAUCHE_USE_AXTLS)
    /* NB: we don't support certificate validation/trust. future work
       will have to take care of this if anyone cares about it at the
       policy level. (it should be noted that axTLS does support this;
       we just don't use it at the moment) */
    t->ctx = ssl_ctx_new(SSL_SERVER_VERIFY_LATER, 0);
    t->conn = NULL;
    t->in_port = t->out_port = 0;
#endif /*GAUCHE_USE_AXTLS*/
    Scm_RegisterFinalizer(SCM_OBJ(t), tls_finalize, NULL);
    return SCM_OBJ(t);
}
Example #6
0
void Scm_GCSentinel(void *obj, const char *name)
{
    Scm_RegisterFinalizer(SCM_OBJ(obj), gc_sentinel, (void*)name);
}