当前位置: 首页>>代码示例>>C++>>正文


C++ disable_python_threads函数代码示例

本文整理汇总了C++中disable_python_threads函数的典型用法代码示例。如果您正苦于以下问题:C++ disable_python_threads函数的具体用法?C++ disable_python_threads怎么用?C++ disable_python_threads使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了disable_python_threads函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: python_api_log_error

static PyObject *
python_api_log_error(PyObject *self, PyObject *args)
{
    PyObject *message = NULL;
    if (!PyArg_ParseTuple(args, "O", &message)) {
        Py_RETURN_NONE;
    }

    char *message_str = python_str_or_unicode_to_string(message);

    allow_python_threads();
    api_log_error(message_str);
    free(message_str);
    disable_python_threads();

    Py_RETURN_NONE;
}
开发者ID:anossov,项目名称:profanity,代码行数:17,代码来源:python_api.c

示例2: python_api_cons_bad_cmd_usage

static PyObject*
python_api_cons_bad_cmd_usage(PyObject *self, PyObject *args)
{
    PyObject *cmd = NULL;
    if (!PyArg_ParseTuple(args, "O", &cmd)) {
        Py_RETURN_NONE;
    }

    char *cmd_str = python_str_or_unicode_to_string(cmd);

    allow_python_threads();
    api_cons_bad_cmd_usage(cmd_str);
    free(cmd_str);
    disable_python_threads();

    Py_RETURN_NONE;
}
开发者ID:anossov,项目名称:profanity,代码行数:17,代码来源:python_api.c

示例3: python_api_send_line

static PyObject*
python_api_send_line(PyObject *self, PyObject *args)
{
    PyObject *line = NULL;
    if (!PyArg_ParseTuple(args, "O", &line)) {
        Py_RETURN_NONE;
    }

    char *line_str = python_str_or_unicode_to_string(line);

    allow_python_threads();
    api_send_line(line_str);
    free(line_str);
    disable_python_threads();

    Py_RETURN_NONE;
}
开发者ID:anossov,项目名称:profanity,代码行数:17,代码来源:python_api.c

示例4: python_api_encryption_reset

static PyObject*
python_api_encryption_reset(PyObject *self, PyObject *args)
{
    PyObject *barejid = NULL;
    if (!PyArg_ParseTuple(args, "O", &barejid)) {
        Py_RETURN_NONE;
    }

    char *barejid_str = python_str_or_unicode_to_string(barejid);

    allow_python_threads();
    api_encryption_reset(barejid_str);
    free(barejid_str);
    disable_python_threads();

    Py_RETURN_NONE;
}
开发者ID:anossov,项目名称:profanity,代码行数:17,代码来源:python_api.c

示例5: python_on_shutdown_hook

void
python_on_shutdown_hook(ProfPlugin *plugin)
{
    disable_python_threads();
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_on_shutdown")) {
        p_function = PyObject_GetAttrString(p_module, "prof_on_shutdown");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject_CallObject(p_function, NULL);
            python_check_error();
            Py_XDECREF(p_function);
        }
    }
    allow_python_threads();
}
开发者ID:cristy-the-one,项目名称:profanity,代码行数:18,代码来源:python_plugins.c

示例6: python_on_disconnect_hook

void
python_on_disconnect_hook(ProfPlugin *plugin, const char *const account_name, const char *const fulljid)
{
    disable_python_threads();
    PyObject *p_args = Py_BuildValue("ss", account_name, fulljid);
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_on_disconnect")) {
        p_function = PyObject_GetAttrString(p_module, "prof_on_disconnect");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject_CallObject(p_function, p_args);
            python_check_error();
            Py_XDECREF(p_function);
        }
    }
    allow_python_threads();
}
开发者ID:cristy-the-one,项目名称:profanity,代码行数:19,代码来源:python_plugins.c

示例7: python_post_room_message_send_hook

void
python_post_room_message_send_hook(ProfPlugin *plugin, const char *const room, const char *message)
{
    disable_python_threads();
    PyObject *p_args = Py_BuildValue("ss", room, message);
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_post_room_message_send")) {
        p_function = PyObject_GetAttrString(p_module, "prof_post_room_message_send");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject_CallObject(p_function, p_args);
            python_check_error();
            Py_XDECREF(p_function);
        }
    }

    allow_python_threads();
}
开发者ID:cristy-the-one,项目名称:profanity,代码行数:20,代码来源:python_plugins.c

示例8: python_post_chat_message_display_hook

void
python_post_chat_message_display_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource, const char *message)
{
    disable_python_threads();
    PyObject *p_args = Py_BuildValue("sss", barejid, resource, message);
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_post_chat_message_display")) {
        p_function = PyObject_GetAttrString(p_module, "prof_post_chat_message_display");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject_CallObject(p_function, p_args);
            python_check_error();
            Py_XDECREF(p_function);
        }
    }
    Py_XDECREF(p_args);
    allow_python_threads();
}
开发者ID:sizeofvoid,项目名称:profanity,代码行数:20,代码来源:python_plugins.c

示例9: python_on_room_win_focus_hook

void
python_on_room_win_focus_hook(ProfPlugin *plugin, const char *const roomjid)
{
    disable_python_threads();
    PyObject *p_args = Py_BuildValue("(s)", roomjid);
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_on_room_win_focus")) {
        p_function = PyObject_GetAttrString(p_module, "prof_on_room_win_focus");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject_CallObject(p_function, p_args);
            python_check_error();
            Py_XDECREF(p_function);
        }
    }

    allow_python_threads();
}
开发者ID:cristy-the-one,项目名称:profanity,代码行数:20,代码来源:python_plugins.c

示例10: python_api_room_unset_message_char

static PyObject*
python_api_room_unset_message_char(PyObject *self, PyObject *args)
{
    PyObject *roomjid = NULL;
    if (!PyArg_ParseTuple(args, "O", &roomjid)) {
        Py_RETURN_NONE;
    }

    char *roomjid_str = python_str_or_unicode_to_string(roomjid);

    allow_python_threads();
    int res = api_room_unset_message_char(roomjid_str);
    free(roomjid_str);
    disable_python_threads();

    if (res) {
        return Py_BuildValue("O", Py_True);
    } else {
        return Py_BuildValue("O", Py_False);
    }
}
开发者ID:anossov,项目名称:profanity,代码行数:21,代码来源:python_api.c

示例11: python_api_chat_unset_titlebar_enctext

static PyObject*
python_api_chat_unset_titlebar_enctext(PyObject *self, PyObject *args)
{
    PyObject *barejid = NULL;
    if (!PyArg_ParseTuple(args, "O", &barejid)) {
        Py_RETURN_NONE;
    }

    char *barejid_str = python_str_or_unicode_to_string(barejid);

    allow_python_threads();
    int res = api_chat_unset_titlebar_enctext(barejid_str);
    free(barejid_str);
    disable_python_threads();

    if (res) {
        return Py_BuildValue("O", Py_True);
    } else {
        return Py_BuildValue("O", Py_False);
    }
}
开发者ID:anossov,项目名称:profanity,代码行数:21,代码来源:python_api.c

示例12: python_on_contact_presence_hook

void
python_on_contact_presence_hook(ProfPlugin *plugin, const char *const barejid, const char *const resource,
    const char *const presence, const char *const status, const int priority)
{
    disable_python_threads();
    PyObject *p_args = Py_BuildValue("ssssi", barejid, resource, presence, status, priority);
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_on_contact_presence")) {
        p_function = PyObject_GetAttrString(p_module, "prof_on_contact_presence");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject_CallObject(p_function, p_args);
            python_check_error();
            Py_XDECREF(p_function);
        }
    }

    allow_python_threads();
}
开发者ID:cristy-the-one,项目名称:profanity,代码行数:21,代码来源:python_plugins.c

示例13: python_on_room_history_message_hook

void
python_on_room_history_message_hook(ProfPlugin *plugin, const char *const room, const char *const nick,
    const char *const message, const char *const timestamp)
{
    disable_python_threads();
    PyObject *p_args = Py_BuildValue("ssss", room, nick, message, timestamp);
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_on_room_history_message")) {
        p_function = PyObject_GetAttrString(p_module, "prof_on_room_history_message");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject_CallObject(p_function, p_args);
            python_check_error();
            Py_XDECREF(p_function);
        }
    }

    allow_python_threads();
}
开发者ID:cristy-the-one,项目名称:profanity,代码行数:21,代码来源:python_plugins.c

示例14: python_on_iq_stanza_receive_hook

gboolean
python_on_iq_stanza_receive_hook(ProfPlugin *plugin, const char *const text)
{
    disable_python_threads();
    PyObject *p_args = Py_BuildValue("(s)", text);
    PyObject *p_function;

    PyObject *p_module = plugin->module;
    if (PyObject_HasAttrString(p_module, "prof_on_iq_stanza_receive")) {
        p_function = PyObject_GetAttrString(p_module, "prof_on_iq_stanza_receive");
        python_check_error();
        if (p_function && PyCallable_Check(p_function)) {
            PyObject *result = PyObject_CallObject(p_function, p_args);
            python_check_error();
            Py_XDECREF(p_function);
            Py_XDECREF(p_args);
            return _handle_boolean_result(plugin, result, "prof_on_iq_stanza_receive");
        }
    }
    Py_XDECREF(p_args);
    allow_python_threads();
    return TRUE;
}
开发者ID:sizeofvoid,项目名称:profanity,代码行数:23,代码来源:python_plugins.c


注:本文中的disable_python_threads函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。