# Preventing a code listing of multiple pages to be split to several parts

I have a lstlisting that doesn't fit on one page. It continues correctly on another page but instead of putting the last lines in the beginning of the next page it actually splits into three parts on three pages with other floats in between.

Is there anyway to prevent these floats appearing there in between?

My code is essentially just:

\begin{lstlisting}

Lots of lines here

\end{lstlisting}


\FloatBarrier of package placeins could be put before \begin{lstlisting} to output the pending floats before the long listing that should not be interrupted by floats.