# mtcp_create_context

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
NOTES
AUTHORS
SEE ALSO
COLOPHON

## NAME

mtcp_create_context − create mTCP context for network communication

## SYNOPSIS

#include <mtcp_api.h>

mctx_t mtcp_create_context(int cpu);

## DESCRIPTION

mtcp_create_context() creates the underlying mTCP stack based on the parameters passed by the mtcp_init() function call. Each mTCP thread requires its own exclusive invocation of the mtcp_create_context() routine before the stack can be used for network communication. The function requires a sole cpu integer argument that passes the CPU core-id of the system on which the stack is instantiated.

## RETURN VALUE

Returns mctx on success; NULL on failure. Please see the NOTES section for details.

## NOTES

The user cannot call mtcp_create_context() function more than once using the same cpu-id in a process.

Passing an invalid CPU core-id (value < 0 or value > max_cpus) will prevent the creation of the mTCP stack.

It is suggested that the user creates only 1 mTCP context thread per core for performance reasons.

## AUTHORS

mTCP development team <mtcp-user@list.ndsl.kaist.edu>

## SEE ALSO

mtcp_destroy_context(), mtcp_init(), mtcp_destroy()

## COLOPHON

This page is part of mTCP release 3.0 docs section. A description of the project, and information about reporting bugs, can be found at http://shader.kaist.edu/mtcp/.