I have tested this patch on FreeBSD 11.1:
Note: This test requires cqueues to be available to Lua53.
The following cqueues code fails if pthread is not linked to Lua53. The word "data" is NOT printed to the screen when it fails.
local cqueues = require 'cqueues'
local thread = require 'cqueues.thread'
local function print_data(sock, data) print(data) end
local function start()
local thr,sock = thread.start(print_data, 'data')
thr:join()
end
local function test() print('test') end
local loop = cqueues.new()
loop:wrap(start)
--loop:wrap(test)
loop:loop()